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 ConstantDescription -
Field Summary
Modifier and TypeFieldDescriptionstatic final Permission[]
Empty array of Permission enum, useful for optimized use inCollection.toArray(Object[])
. -
Method Summary
Modifier and TypeMethodDescriptionstatic Permission
getFromOffset
(int offset) Gets the firstPermission
relating to the provided offset.getName()
The readable name as used in the Discord client.int
The binary offset of the permission.static EnumSet<Permission>
getPermissions
(long permissions) A set of allPermissions
that are specified by this raw long representation of permissions.static long
getRaw
(Collection<Permission> permissions) This is effectively the opposite ofgetPermissions(long)
, this takes a Collection ofPermissions
and returns the raw offsetlong
representation of the permissions.static long
getRaw
(Permission... permissions) This is effectively the opposite ofgetPermissions(long)
, this takes 1 or morePermissions
and returns the raw offsetlong
representation of the permissions.long
The value of this permission when viewed as a raw value.boolean
Returns whether or not this Permission is present Channel level (configurable viaPermissionsOverrides
)boolean
isGuild()
Returns whether or not this Permission is present at the Guild level (configurable viaRoles
)static Permission
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.
-
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
-
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 firstPermission
relating to the provided offset.
If there is noPermssions
that matches the provided offset,Permission.UNKNOWN
is returned.- Parameters:
offset
- The offset to match aPermission
to.- Returns:
Permission
relating to the provided offset.
-
getPermissions
A set of allPermissions
that are specified by this raw long representation of permissions. The is best used with the getRaw methods inRole
orPermissionOverride
.Example:
Role.getPermissionsRaw()
- Parameters:
permissions
- The rawlong
representation of permissions.- Returns:
- Possibly-empty EnumSet of
Permissions
.
-
getRaw
This is effectively the opposite ofgetPermissions(long)
, this takes 1 or morePermissions
and returns the raw offsetlong
representation 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 ofPermissions
and returns the raw offsetlong
representation 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:
-