Package net.dv8tion.jda.api
Enum Permission
- All Implemented Interfaces:
Serializable,Comparable<Permission>
Represents the bit offsets used by Discord for Permissions.
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longAll permissions that apply to a channelstatic final longAll Guild specific permissions which are only available to rolesstatic final longRepresents a raw set of all permissionsstatic final longAll text channel specific permissions which are only available in text channel permission overridesstatic final longAll voice channel specific permissions which are only available in voice channel permission overridesstatic final Permission[]Empty array of Permission enum, useful for optimized use inCollection.toArray(Object[]). -
Method Summary
Modifier and TypeMethodDescriptionstatic PermissiongetFromOffset(int offset) Gets the firstPermissionrelating to the provided offset.getName()The readable name as used in the Discord client.intThe binary offset of the permission.static EnumSet<Permission>getPermissions(long permissions) A set of allPermissionsthat are specified by this raw long representation of permissions.static longgetRaw(Collection<Permission> permissions) This is effectively the opposite ofgetPermissions(long), this takes a Collection ofPermissionsand returns the raw offsetlongrepresentation of the permissions.static longgetRaw(Permission... permissions) This is effectively the opposite ofgetPermissions(long), this takes 1 or morePermissionsand returns the raw offsetlongrepresentation of the permissions.longThe value of this permission when viewed as a raw value.booleanReturns whether or not this Permission is present Channel level (configurable viaPermissionsOverrides)booleanisGuild()Returns whether or not this Permission is present at the Guild level (configurable viaRoles)booleanisText()Whether this permission is specifically forTextChannelsbooleanisVoice()Whether this permission is specifically forVoiceChannelsstatic PermissionReturns 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.
-
Enum Constant Details
-
MANAGE_CHANNEL
-
MANAGE_SERVER
-
VIEW_AUDIT_LOGS
-
VIEW_CHANNEL
-
VIEW_GUILD_INSIGHTS
-
MANAGE_ROLES
-
MANAGE_PERMISSIONS
-
MANAGE_WEBHOOKS
-
MANAGE_EMOTES_AND_STICKERS
-
CREATE_INSTANT_INVITE
-
KICK_MEMBERS
-
BAN_MEMBERS
-
NICKNAME_CHANGE
-
NICKNAME_MANAGE
-
MODERATE_MEMBERS
-
MESSAGE_ADD_REACTION
-
MESSAGE_SEND
-
MESSAGE_TTS
-
MESSAGE_MANAGE
-
MESSAGE_EMBED_LINKS
-
MESSAGE_ATTACH_FILES
-
MESSAGE_HISTORY
-
MESSAGE_MENTION_EVERYONE
-
MESSAGE_EXT_EMOJI
-
USE_APPLICATION_COMMANDS
-
MESSAGE_EXT_STICKER
-
MANAGE_THREADS
-
CREATE_PUBLIC_THREADS
-
CREATE_PRIVATE_THREADS
-
MESSAGE_SEND_IN_THREADS
-
PRIORITY_SPEAKER
-
VOICE_STREAM
-
VOICE_CONNECT
-
VOICE_SPEAK
-
VOICE_MUTE_OTHERS
-
VOICE_DEAF_OTHERS
-
VOICE_MOVE_OTHERS
-
VOICE_USE_VAD
-
VOICE_START_ACTIVITIES
-
REQUEST_TO_SPEAK
-
ADMINISTRATOR
-
UNKNOWN
-
-
Field Details
-
EMPTY_PERMISSIONS
Empty array of Permission enum, useful for optimized use inCollection.toArray(Object[]). -
ALL_PERMISSIONS
public static final long ALL_PERMISSIONSRepresents a raw set of all permissions -
ALL_CHANNEL_PERMISSIONS
public static final long ALL_CHANNEL_PERMISSIONSAll permissions that apply to a channel -
ALL_GUILD_PERMISSIONS
public static final long ALL_GUILD_PERMISSIONSAll Guild specific permissions which are only available to roles -
ALL_TEXT_PERMISSIONS
public static final long ALL_TEXT_PERMISSIONSAll text channel specific permissions which are only available in text channel permission overrides -
ALL_VOICE_PERMISSIONS
public static final long ALL_VOICE_PERMISSIONSAll voice channel specific permissions which are only available in voice channel permission overrides
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getName
The readable name as used in the Discord client.- Returns:
- The readable name of this
Permission.
-
getOffset
public int getOffset()The binary offset of the permission.
For more information about Discord's offset system refer to Discord Permissions.- Returns:
- The offset that represents this
Permission.
-
getRawValue
public long getRawValue()The value of this permission when viewed as a raw value.
This is equivalent to:1 <<getOffset()- Returns:
- The raw value of this specific permission.
-
isGuild
public boolean isGuild()Returns whether or not this Permission is present at the Guild level (configurable viaRoles)- Returns:
- True if this permission is present at the Guild level.
-
isChannel
public boolean isChannel()Returns whether or not this Permission is present Channel level (configurable viaPermissionsOverrides)- Returns:
- True if this permission is present at the Channel level.
-
isText
public boolean isText()Whether this permission is specifically forTextChannels- Returns:
- True, if and only if this permission can only be applied to text channels
-
isVoice
public boolean isVoice()Whether this permission is specifically forVoiceChannels- Returns:
- True, if and only if this permission can only be applied to voice channels
-
getFromOffset
Gets the firstPermissionrelating to the provided offset.
If there is noPermssionsthat matches the provided offset,Permission.UNKNOWNis returned.- Parameters:
offset- The offset to match aPermissionto.- Returns:
Permissionrelating to the provided offset.
-
getPermissions
A set of allPermissionsthat are specified by this raw long representation of permissions. The is best used with the getRaw methods inRoleorPermissionOverride.Example:
Role.getPermissionsRaw()- Parameters:
permissions- The rawlongrepresentation of permissions.- Returns:
- Possibly-empty EnumSet of
Permissions.
-
getRaw
This is effectively the opposite ofgetPermissions(long), this takes 1 or morePermissionsand returns the raw offsetlongrepresentation of the permissions.- Parameters:
permissions- The array of permissions of which to form into the raw long representation.- Returns:
- Unsigned long representing the provided permissions.
-
getRaw
This is effectively the opposite ofgetPermissions(long), this takes a Collection ofPermissionsand returns the raw offsetlongrepresentation of the permissions.
Example:getRaw(EnumSet.of(Permission.VIEW_CHANNEL, Permission.MESSAGE_SEND))- Parameters:
permissions- The Collection of permissions of which to form into the raw long representation.- Returns:
- Unsigned long representing the provided permissions.
- See Also:
-