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 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)static 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_GUILD_EXPRESSIONS
-
MANAGE_EVENTS
-
USE_EMBEDDED_ACTIVITIES
-
VIEW_CREATOR_MONETIZATION_ANALYTICS
-
CREATE_GUILD_EXPRESSIONS
-
CREATE_SCHEDULED_EVENTS
-
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
-
MESSAGE_ATTACH_VOICE_MESSAGE
-
MESSAGE_SEND_POLLS
-
USE_EXTERNAL_APPLICATIONS
-
PIN_MESSAGES
-
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_USE_SOUNDBOARD
-
VOICE_USE_EXTERNAL_SOUNDS
-
VOICE_SET_STATUS
-
REQUEST_TO_SPEAK
-
ADMINISTRATOR
-
UNKNOWN
-
-
Field Details
-
EMPTY_PERMISSIONS
Empty array of Permission enum, useful for optimized use inCollection.toArray(Object[]).
-
-
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.
-
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:
-