public class PermissionOverrideAction extends AuditableRestAction<PermissionOverride>
RestAction
specifically
designed to create a PermissionOverride
for a Channel
.
This extension allows setting properties before executing the action.AuditableRestAction.EmptyRestAction<T>
DEFAULT_FAILURE, DEFAULT_SUCCESS, LOG
Constructor | Description |
---|---|
PermissionOverrideAction(JDA api,
net.dv8tion.jda.core.requests.Route.CompiledRoute route,
Channel channel,
Member member) |
Creates a new PermissionOverrideAction instance
|
PermissionOverrideAction(JDA api,
net.dv8tion.jda.core.requests.Route.CompiledRoute route,
Channel channel,
Role role) |
Creates a new PermissionOverrideAction instance
|
Modifier and Type | Method | Description |
---|---|---|
long |
getAllow() |
The currently set of allowed permission bits.
|
java.util.List<Permission> |
getAllowedPermissions() |
Immutable list of
Permissions
that would be granted by the PermissionOverride that is created by this action. |
java.util.List<Permission> |
getDeniedPermissions() |
Immutable list of
Permissions
that would be denied by the PermissionOverride that is created by this action. |
long |
getDeny() |
The currently set of denied permission bits.
|
long |
getInherited() |
The currently set of inherited permission bits.
|
java.util.List<Permission> |
getInheritedPermissions() |
Immutable list of
Permissions
that would be inherited from other permission holders. |
boolean |
isMember() |
Whether this Action will
create a
PermissionOverride
for a Member or not |
boolean |
isRole() |
Whether this Action will
create a
PermissionOverride
for a Role or not |
PermissionOverrideAction |
setAllow(long allowBits) |
Sets the value of explicitly granted permissions
using the bitwise representation of a set of
Permissions . |
PermissionOverrideAction |
setAllow(java.util.Collection<Permission> permissions) |
Sets the value of explicitly granted permissions
using a Collection of
Permissions . |
PermissionOverrideAction |
setAllow(Permission... permissions) |
Sets the value of explicitly granted permissions
using a set of
Permissions . |
PermissionOverrideAction |
setCheck(java.util.function.BooleanSupplier checks) |
Sets the last-second checks before finally executing the http request in the queue.
|
PermissionOverrideAction |
setDeny(long denyBits) |
Sets the value of explicitly denied permissions
using the bitwise representation of a set of
Permissions . |
PermissionOverrideAction |
setDeny(java.util.Collection<Permission> permissions) |
Sets the value of explicitly denied permissions
using a Collection of
Permissions . |
PermissionOverrideAction |
setDeny(Permission... permissions) |
Sets the value of explicitly denied permissions
using a set of
Permissions . |
PermissionOverrideAction |
setPermissions(long allowBits,
long denyBits) |
Combination of
setAllow(long) and setDeny(long) |
PermissionOverrideAction |
setPermissions(java.util.Collection<Permission> grantPermissions,
java.util.Collection<Permission> denyPermissions) |
Combination of
setAllow(java.util.Collection) and setDeny(java.util.Collection)
If a passed collection is null it resets the represented value to 0 - no permission specifics. |
reason
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
complete, complete, completeAfter, getJDA, isPassContext, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, setPassContext, submit, submit, submitAfter, submitAfter
public PermissionOverrideAction(JDA api, net.dv8tion.jda.core.requests.Route.CompiledRoute route, Channel channel, Member member)
public PermissionOverrideAction setCheck(java.util.function.BooleanSupplier checks)
RestAction
false
or throws an exception this will not be finished.
When an exception is thrown from the supplier it will be provided to the failure callback.setCheck
in class AuditableRestAction<PermissionOverride>
checks
- The checks to run before executing the request, or null
to run no checkspublic long getAllow()
Use getAllowedPermissions()
to retrieve a List
with Permissions
for this value
public java.util.List<Permission> getAllowedPermissions()
Permissions
that would be granted by the PermissionOverride that is created by this action.Permissions
public long getDeny()
Use getDeniedPermissions()
to retrieve a List
with Permissions
for this value
public java.util.List<Permission> getDeniedPermissions()
Permissions
that would be denied by the PermissionOverride that is created by this action.Permissions
public long getInherited()
Use getInheritedPermissions()
to retrieve a List
with Permissions
for this value
public java.util.List<Permission> getInheritedPermissions()
Permissions
that would be inherited from other permission holders.
Permissions
getInherited()
public boolean isMember()
PermissionOverride
for a Member
or notpublic boolean isRole()
PermissionOverride
for a Role
or notfalse
it is targeting a Member
. (isMember()
)@CheckReturnValue public PermissionOverrideAction setAllow(long allowBits)
Permissions
.
Permissions.getRaw(Permission...)
!
isChannel()
will have no affect!allowBits
- The positive bits representing the granted
permissions for the new PermissionOverridejava.lang.IllegalArgumentException
- If the provided bits are negative
or higher than Permission.ALL_PERMISSIONS
setAllow(Collection)
,
setAllow(Permission...)
@CheckReturnValue public PermissionOverrideAction setAllow(java.util.Collection<Permission> permissions)
Permissions
.
isChannel()
will have no affect!
Example: setAllow(EnumSet.of(Permission.MESSAGE_READ))
permissions
- The Collection of Permissions representing the granted
permissions for the new PermissionOverride.
null
the permissions are reset to the default of nonejava.lang.IllegalArgumentException
- If the any of the specified Permissions is null
EnumSet
,
setAllow(Permission...)
@CheckReturnValue public PermissionOverrideAction setAllow(Permission... permissions)
Permissions
.
isChannel()
will have no affect!permissions
- The Permissions representing the granted
permissions for the new PermissionOverride.
null
the permissions are reset to the default of nonejava.lang.IllegalArgumentException
- If the any of the specified Permissions is null
@CheckReturnValue public PermissionOverrideAction setDeny(long denyBits)
Permissions
.
Permissions.getRaw(Permission...)
!
isChannel()
will have no affect!denyBits
- The positive bits representing the denied
permissions for the new PermissionOverridejava.lang.IllegalArgumentException
- If the provided bits are negative
or higher than Permission.ALL_PERMISSIONS
setDeny(Collection)
,
setDeny(Permission...)
@CheckReturnValue public PermissionOverrideAction setDeny(java.util.Collection<Permission> permissions)
Permissions
.
isChannel()
will have no affect!
Example: setDeny(EnumSet.of(Permission.MESSAGE_WRITE, Permission.MESSAGE_EXT_EMOJI))
permissions
- The Collection of Permissions representing the denied
permissions for the new PermissionOverride.
null
the permissions are reset to the default of nonejava.lang.IllegalArgumentException
- If the any of the specified Permissions is null
EnumSet
,
setDeny(Permission...)
@CheckReturnValue public PermissionOverrideAction setDeny(Permission... permissions)
Permissions
.
isChannel()
will have no affect!permissions
- The Permissions representing the denied
permissions for the new PermissionOverride.
null
the permissions are reset to the default of nonejava.lang.IllegalArgumentException
- If the any of the specified Permissions is null
@CheckReturnValue public PermissionOverrideAction setPermissions(long allowBits, long denyBits)
setAllow(long)
and setDeny(long)
allowBits
- A non-negative bitwise representation
of granted PermissionsdenyBits
- A non-negative bitwise representation
of denied Permissionsjava.lang.IllegalArgumentException
- If any of the provided bits are negative
or higher than Permission.ALL_PERMISSIONS
setPermissions(java.util.Collection, java.util.Collection)
,
Permission.getRaw(Permission...)
,
Permission.getRaw(Collection)
@CheckReturnValue public PermissionOverrideAction setPermissions(java.util.Collection<Permission> grantPermissions, java.util.Collection<Permission> denyPermissions)
setAllow(java.util.Collection)
and setDeny(java.util.Collection)
null
it resets the represented value to 0
- no permission specifics.
Example: setPermissions(EnumSet.of(Permission.MESSAGE_READ), EnumSet.of(Permission.MESSAGE_WRITE, Permission.MESSAGE_EXT_EMOJI))
grantPermissions
- A Collection of Permissions
representing all explicitly granted Permissions for the PermissionOverridedenyPermissions
- A Collection of Permissions
representing all explicitly denied Permissions for the PermissionOverridejava.lang.IllegalArgumentException
- If the any of the specified Permissions is null
EnumSet
,
Permission.getRaw(Collection)