/** * Revokes the specified {@link net.dv8tion.jda.core.Permission Permissions} from the selected {@link net.dv8tion.jda.core.entities.Role Role}. * * <p>Permissions may only include already present Permissions for the currently logged in account. * <br>You are unable to revoke permissions you don't have! * * @param perms * The permission to give to the selected {@link net.dv8tion.jda.core.entities.Role Role} * * @throws net.dv8tion.jda.core.exceptions.InsufficientPermissionException * If the currently logged in account does not have permission to revoke one of the specified permissions * * @return RoleManager for chaining convenience * * @see #setPermissions(Collection) * @see #setPermissions(Permission...) * @see java.util.EnumSet EnumSet * @see net.dv8tion.jda.core.Permission#getRaw(java.util.Collection) Permission.getRaw(Collection) */ @CheckReturnValue public RoleManager revokePermissions(Collection<Permission> perms) { Checks.noneNull(perms, "Permissions"); setupPermissions(); return setPermissions(this.permissions & ~Permission.getRaw(perms)); }
/** * Adds the specified {@link net.dv8tion.jda.core.Permission Permissions} to the selected {@link net.dv8tion.jda.core.entities.Role Role}. * * <p>Permissions may only include already present Permissions for the currently logged in account. * <br>You are unable to give permissions you don't have! * * @param perms * The permission to give to the selected {@link net.dv8tion.jda.core.entities.Role Role} * * @throws net.dv8tion.jda.core.exceptions.InsufficientPermissionException * If the currently logged in account does not have permission to apply one of the specified permissions * * @return RoleManager for chaining convenience * * @see #setPermissions(Collection) * @see #setPermissions(Permission...) * @see java.util.EnumSet EnumSet * @see net.dv8tion.jda.core.Permission#getRaw(java.util.Collection) Permission.getRaw(Collection) */ @CheckReturnValue public RoleManager givePermissions(Collection<Permission> perms) { Checks.noneNull(perms, "Permissions"); setupPermissions(); return setPermissions(this.permissions | Permission.getRaw(perms)); }
setupPermissions(); long missingPerms = perms; // include permissions we want to set to