public class PermOverrideManagerUpdatable
extends java.lang.Object
updatable manager that allows
to modify PermissionOverride settings
such as the granted and denied Permissions.
This manager allows to modify multiple fields at once followed by a call of update()!
Default is no permissions granted/denied.
The PermOverrideManager implementation
simplifies this process by giving simple setters that return the update RestAction
Note: To update this manager
the currently logged in account requires the Permission MANAGE_PERMISSIONS
in the parent Channel
| Constructor and Description |
|---|
PermOverrideManagerUpdatable(PermissionOverride override)
Creates a new PermOverrideManagerUpdatable instance
|
| Modifier and Type | Method and Description |
|---|---|
PermOverrideManagerUpdatable |
clear(java.util.Collection<Permission> permissions)
Clears the specified
Permissions
from the target PermissionOverride
This will make the specified Permissions be inherited |
PermOverrideManagerUpdatable |
clear(long permission)
Clears the specified permission bits
from the target
PermissionOverride
This will make the specified Permissions be inherited |
PermOverrideManagerUpdatable |
clear(Permission... permissions)
Clears the specified
Permissions
from the target PermissionOverride
This will make the specified Permissions be inherited |
PermOverrideManagerUpdatable |
deny(java.util.Collection<Permission> permissions)
Denies the specified
Permissions
from the target PermissionOverride |
PermOverrideManagerUpdatable |
deny(long permissions)
Denies the specified permission bits
from the target
PermissionOverride |
PermOverrideManagerUpdatable |
deny(Permission... permissions)
Denies the specified
Permissions
from the target PermissionOverride |
java.lang.Long |
getAllowBits()
The granted
Permissions
value represented as raw long bits. |
Channel |
getChannel()
The
Channel this Manager's
PermissionOverride is in. |
java.lang.Long |
getDenyBits()
The denied
Permissions
value represented as raw long bits. |
Guild |
getGuild()
|
java.lang.Long |
getInheritBits()
The inherited
Permissions
value represented as raw long bits. |
JDA |
getJDA()
The
JDA instance of this Manager |
PermissionOverride |
getPermissionOverride()
The target
PermissionOverride
that will be modified by this Manager |
PermOverrideManagerUpdatable |
grant(java.util.Collection<Permission> permissions)
Grants the specified
Permissions
to the target PermissionOverride |
PermOverrideManagerUpdatable |
grant(long permissions)
Grants the specified permission bits
to the target
PermissionOverride |
PermOverrideManagerUpdatable |
grant(Permission... permissions)
Grants the specified
Permissions
to the target PermissionOverride |
boolean |
isSet()
Whether anything has been modified yet
|
void |
reset()
|
AuditableRestAction<java.lang.Void> |
update()
Creates a new
RestAction instance
that will apply all changes that have been made to this manager instance. |
public PermOverrideManagerUpdatable(PermissionOverride override)
override - The PermissionOverride to managepublic Guild getGuild()
Guild this Manager's
Channel is in.
getPermissionOverride().getGuild()Guildpublic Channel getChannel()
Channel this Manager's
PermissionOverride is in.
getPermissionOverride().getChannel()Channelpublic PermissionOverride getPermissionOverride()
PermissionOverride
that will be modified by this ManagerPermissionOverride@CheckReturnValue public PermOverrideManagerUpdatable grant(long permissions)
PermissionOverridepermissions - Raw permission bits to grantInsufficientPermissionException - If any of the provided permissions are not accessible@CheckReturnValue public PermOverrideManagerUpdatable grant(Permission... permissions)
Permissions
to the target PermissionOverridepermissions - Permissions to grantInsufficientPermissionException - If any of the provided permissions are not accessiblejava.lang.IllegalArgumentException - If any of the provided permissions is null@CheckReturnValue public PermOverrideManagerUpdatable grant(java.util.Collection<Permission> permissions)
Permissions
to the target PermissionOverridepermissions - Permissions to grantInsufficientPermissionException - If any of the provided permissions are not accessiblejava.lang.IllegalArgumentException - If any of the provided permissions is null@CheckReturnValue public PermOverrideManagerUpdatable deny(long permissions)
PermissionOverridepermissions - Raw permission bits to denyInsufficientPermissionException - If any of the provided permissions are not accessible@CheckReturnValue public PermOverrideManagerUpdatable deny(Permission... permissions)
Permissions
from the target PermissionOverridepermissions - Permissions to denyInsufficientPermissionException - If any of the provided permissions are not accessiblejava.lang.IllegalArgumentException - If any of the provided permissions is null@CheckReturnValue public PermOverrideManagerUpdatable deny(java.util.Collection<Permission> permissions)
Permissions
from the target PermissionOverridepermissions - Permissions to denyInsufficientPermissionException - If any of the provided permissions are not accessiblejava.lang.IllegalArgumentException - If any of the provided permissions is null@CheckReturnValue public PermOverrideManagerUpdatable clear(long permission)
PermissionOverride
permission - Raw permission bits to clearInsufficientPermissionException - If any of the provided permissions are not accessible@CheckReturnValue public PermOverrideManagerUpdatable clear(Permission... permissions)
Permissions
from the target PermissionOverride
permissions - Permissions to clearInsufficientPermissionException - If any of the provided permissions are not accessiblejava.lang.IllegalArgumentException - If any of the provided permissions is null@CheckReturnValue public PermOverrideManagerUpdatable clear(java.util.Collection<Permission> permissions)
Permissions
from the target PermissionOverride
permissions - Permissions to clearInsufficientPermissionException - If any of the provided permissions are not accessiblejava.lang.IllegalArgumentException - If any of the provided permissions is nullpublic java.lang.Long getAllowBits()
Permissions
value represented as raw long bits.
Permission.getPermissions(long) to retrieve a list of Permissions
from the returned bits.
This value represents all permissions that should be granted by this PermissionOverride
Permissions value
or null if isSet() is falsepublic java.lang.Long getDenyBits()
Permissions
value represented as raw long bits.
Permission.getPermissions(long) to retrieve a list of Permissions
from the returned bits.
This value represents all permissions that should be denied by this PermissionOverride
Permissions value
or null if isSet() is falsepublic java.lang.Long getInheritBits()
Permissions
value represented as raw long bits.
Permission.getPermissions(long) to retrieve a list of Permissions
from the returned bits.
This value represents all permissions that are not granted or denied by the settings of this Manager instance - thus they represent all permissions that are set to inherit from other overrides.
Permissions value
or null if isSet() is falsepublic boolean isSet()
public void reset()
@CheckReturnValue public AuditableRestAction<java.lang.Void> update()
RestAction instance
that will apply all changes that have been made to this manager instance.
EmptyRestAction.
Before applying new changes it is recommended to call reset() to reset previous changes.
This is automatically called if this method returns successfully.
Possible ErrorResponses for this
update include the following:
UNKNOWN_OVERRIDE
MISSING_ACCESS
MISSING_PERMISSIONS
MANAGE_PERMISSIONS PermissionAuditableRestAction
InsufficientPermissionException - If the currently logged in account does not have the Permission MANAGE_PERMISSIONS
in the Channel