java.io.Serializable
, java.lang.Comparable<Permission>
public enum Permission extends java.lang.Enum<Permission>
Modifier and Type | Field | Description |
---|---|---|
static long |
ALL_CHANNEL_PERMISSIONS |
All permissions that apply to a channel
|
static long |
ALL_GUILD_PERMISSIONS |
All Guild specific permissions which are only available to roles
|
static long |
ALL_PERMISSIONS |
Represents a raw set of all permissions
|
static long |
ALL_TEXT_PERMISSIONS |
All text channel specific permissions which are only available in text channel permission overrides
|
static long |
ALL_VOICE_PERMISSIONS |
All voice channel specific permissions which are only available in voice channel permission overrides
|
static Permission[] |
EMPTY_PERMISSIONS |
Empty array of Permission enum, useful for optimized use in
Collection.toArray(Object[]) . |
Modifier and Type | Method | Description |
---|---|---|
static Permission |
getFromOffset(int offset) |
Gets the first
Permission relating to the provided offset. |
java.lang.String |
getName() |
The readable name as used in the Discord client.
|
int |
getOffset() |
The binary offset of the permission.
|
static java.util.List<Permission> |
getPermissions(long permissions) |
A list of all
Permissions that are specified by this raw long representation of
permissions. |
static long |
getRaw(java.util.Collection<Permission> permissions) |
This is effectively the opposite of
getPermissions(long) , this takes a Collection of Permissions
and returns the raw offset long representation of the permissions. |
static long |
getRaw(Permission... permissions) |
This is effectively the opposite of
getPermissions(long) , this takes 1 or more Permissions
and returns the raw offset long representation of the permissions. |
long |
getRawValue() |
The value of this permission when viewed as a raw value.
|
boolean |
isChannel() |
Returns whether or not this Permission is present Channel level
(configurable via
PermissionsOverrides ) |
boolean |
isGuild() |
Returns whether or not this Permission is present at the Guild level
(configurable via
Roles ) |
boolean |
isText() |
Whether this permission is specifically for
TextChannels |
boolean |
isVoice() |
Whether this permission is specifically for
VoiceChannels |
static java.util.EnumSet<Permission> |
toEnumSet(long permissions) |
Constructs an
EnumSet from the provided permissions bitmask. |
static Permission |
valueOf(java.lang.String name) |
Returns the enum constant of this type with the specified name.
|
static Permission[] |
values() |
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Permission CREATE_INSTANT_INVITE
public static final Permission KICK_MEMBERS
public static final Permission BAN_MEMBERS
public static final Permission ADMINISTRATOR
public static final Permission MANAGE_CHANNEL
public static final Permission MANAGE_SERVER
public static final Permission MESSAGE_ADD_REACTION
public static final Permission VIEW_AUDIT_LOGS
public static final Permission PRIORITY_SPEAKER
public static final Permission VIEW_CHANNEL
public static final Permission MESSAGE_READ
public static final Permission MESSAGE_WRITE
public static final Permission MESSAGE_TTS
public static final Permission MESSAGE_MANAGE
public static final Permission MESSAGE_EMBED_LINKS
public static final Permission MESSAGE_ATTACH_FILES
public static final Permission MESSAGE_HISTORY
public static final Permission MESSAGE_MENTION_EVERYONE
public static final Permission MESSAGE_EXT_EMOJI
public static final Permission VOICE_CONNECT
public static final Permission VOICE_SPEAK
public static final Permission VOICE_MUTE_OTHERS
public static final Permission VOICE_DEAF_OTHERS
public static final Permission VOICE_MOVE_OTHERS
public static final Permission VOICE_USE_VAD
public static final Permission NICKNAME_CHANGE
public static final Permission NICKNAME_MANAGE
public static final Permission MANAGE_ROLES
public static final Permission MANAGE_PERMISSIONS
public static final Permission MANAGE_WEBHOOKS
public static final Permission MANAGE_EMOTES
public static final Permission UNKNOWN
public static final Permission[] EMPTY_PERMISSIONS
Collection.toArray(Object[])
.public static final long ALL_PERMISSIONS
public static final long ALL_CHANNEL_PERMISSIONS
public static final long ALL_GUILD_PERMISSIONS
public static final long ALL_TEXT_PERMISSIONS
public static final long ALL_VOICE_PERMISSIONS
public static Permission[] values()
for (Permission c : Permission.values()) System.out.println(c);
public static Permission valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic java.lang.String getName()
Permission
.public int getOffset()
Permission
.public long getRawValue()
1 << getOffset()
public boolean isGuild()
Roles
)public boolean isChannel()
PermissionsOverrides
)public boolean isText()
TextChannels
public boolean isVoice()
VoiceChannels
public static Permission getFromOffset(int offset)
Permission
relating to the provided offset.
Permssions
that matches the provided
offset, Permission.UNKNOWN
is returned.offset
- The offset to match a Permission
to.Permission
relating to the provided offset.public static java.util.List<Permission> getPermissions(long permissions)
Permissions
that are specified by this raw long representation of
permissions. The is best used with the getRaw methods in Role
,
PermissionOverride
or PermissionUtil
.
Examples:
Role.getPermissionsRaw()
PermissionUtil.getEffectivePermission(Channel, Member)
permissions
- The raw long
representation of permissions.Permissions
.toEnumSet(long)
public static java.util.EnumSet<Permission> toEnumSet(long permissions)
EnumSet
from the provided permissions bitmask.
0
this will fast-fail with an empty set.permissions
- The permission bitmaskEnumSet
containing the constants for this permission bitmaskpublic static long getRaw(Permission... permissions)
getPermissions(long)
, this takes 1 or more Permissions
and returns the raw offset long
representation of the permissions.permissions
- The array of permissions of which to form into the raw long representation.public static long getRaw(java.util.Collection<Permission> permissions)
getPermissions(long)
, this takes a Collection of Permissions
and returns the raw offset long
representation of the permissions.
getRaw(EnumSet.of(Permission.MESSAGE_READ, Permission.MESSAGE_WRITE))
permissions
- The Collection of permissions of which to form into the raw long representation.EnumSet