/** * Sets the {@link net.dv8tion.jda.core.Permission Permissions} of 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 permissions * The new permission for 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 * @throws java.lang.IllegalArgumentException * If any of the provided values is {@code null} * * @return RoleManager for chaining convenience * * @see #setPermissions(Collection) * @see #setPermissions(long) * @see net.dv8tion.jda.core.Permission#getRaw(net.dv8tion.jda.core.Permission...) Permission.getRaw(Permission...) */ @CheckReturnValue public RoleManager setPermissions(Permission... permissions) { Checks.notNull(permissions, "Permissions"); return setPermissions(Arrays.asList(permissions)); }
/** * Sets the {@link net.dv8tion.jda.core.Permission Permissions} of 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 permissions * The new permission for 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 * @throws java.lang.IllegalArgumentException * If any of the provided values is {@code null} * * @return RoleManager for chaining convenience * * @see #setPermissions(Permission...) * @see #setPermissions(long) * @see java.util.EnumSet EnumSet * @see net.dv8tion.jda.core.Permission#getRaw(java.util.Collection) Permission.getRaw(Collection) */ @CheckReturnValue public RoleManager setPermissions(Collection<Permission> permissions) { Checks.noneNull(permissions, "Permissions"); return setPermissions(Permission.getRaw(permissions)); }
/** * 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)); }