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 long
All permissions that apply to a channelstatic final long
All Guild specific permissions which are only available to rolesstatic final long
Represents a raw set of all permissionsstatic final long
All text channel specific permissions which are only available in text channel permission overridesstatic final long
All 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 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
)boolean
isText()
Whether this permission is specifically forTextChannels
boolean
isVoice()
Whether this permission is specifically forVoiceChannels
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_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 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:
-