package cc.fascinated.bat.common; import cc.fascinated.bat.model.BatGuild; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Role; /** * @author Fascinated (fascinated7) */ public class RoleUtils { /** * Checks if a member has permission to give the role to another member * * @param guild the guild to check * @param member the member to check * @param role the role to check * @return if the member has permission to give the role */ public static boolean hasPermissionToGiveRole(BatGuild guild, Member member, Role role) { return member.getRoles().stream().anyMatch(r -> r.getPosition() > role.getPosition()); } }