Package net.dv8tion.jda.api.entities
Interface IPermissionHolder
-
- All Superinterfaces:
ISnowflake
public interface IPermissionHolder extends ISnowflake
Marker for entities that hold Permissions within JDA
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Guild
getGuild()
The Guild to which this PermissionHolder is relatedEnumSet<Permission>
getPermissions()
The Guild-Wide Permissions this PermissionHolder holds.EnumSet<Permission>
getPermissions(GuildChannel channel)
The Permissions this PermissionHolder holds in the specifiedGuildChannel
.EnumSet<Permission>
getPermissionsExplicit()
The explicitly granted permissions for this permission holder in the guild.EnumSet<Permission>
getPermissionsExplicit(GuildChannel channel)
The explicitly granted permissions for this permission holder in the guild.boolean
hasPermission(Collection<Permission> permissions)
Checks whether or not this PermissionHolder has thePermissions
in the providedCollection<Permission>
in the Guild.boolean
hasPermission(GuildChannel channel, Collection<Permission> permissions)
Checks whether or not this PermissionHolder has thePermissions
in the providedCollection<Permission>
in the specified GuildChannel.boolean
hasPermission(GuildChannel channel, Permission... permissions)
Checks whether or not this PermissionHolder has the givenPermissions
in the specified GuildChannel.boolean
hasPermission(Permission... permissions)
Checks whether or not this PermissionHolder has the givenPermissions
in the Guild.-
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
-
-
-
Method Detail
-
getGuild
@Nonnull Guild getGuild()
The Guild to which this PermissionHolder is related- Returns:
- A never-null Guild to which this PermissionHolder is linked
-
getPermissions
@Nonnull EnumSet<Permission> getPermissions()
The Guild-Wide Permissions this PermissionHolder holds.
Changes to the returned set do not affect this entity directly.- Returns:
- An EnumSet of Permissions granted to this PermissionHolder.
-
getPermissions
@Nonnull EnumSet<Permission> getPermissions(@Nonnull GuildChannel channel)
The Permissions this PermissionHolder holds in the specifiedGuildChannel
.
Permissions returned by this may be different fromgetPermissions()
due to the GuildChannel'sPermissionOverrides
.
Changes to the returned set do not affect this entity directly.- Parameters:
channel
- TheGuildChannel
of which to get Permissions for- Returns:
- Set of Permissions granted to this Permission Holder in the specified channel.
- Throws:
IllegalArgumentException
- If the channel is null
-
getPermissionsExplicit
@Nonnull EnumSet<Permission> getPermissionsExplicit()
The explicitly granted permissions for this permission holder in the guild.
This disregards owner and administrator privileges. For a role this is identical togetPermissions()
and members have all their roles taken into consideration.
Changes to the returned set do not affect this entity directly.- Returns:
- EnumSet of the explicitly granted permissions
-
getPermissionsExplicit
@Nonnull EnumSet<Permission> getPermissionsExplicit(@Nonnull GuildChannel channel)
The explicitly granted permissions for this permission holder in the guild.
This disregards owner and administrator privileges.
Permissions returned by this may be different fromgetPermissionsExplicit()
due to the GuildChannel'sPermissionOverrides
.
Changes to the returned set do not affect this entity directly.- Parameters:
channel
- TheGuildChannel
of which to get Permissions for- Returns:
- EnumSet of the explicitly granted permissions in the specified channel
- Throws:
IllegalArgumentException
- If the channel is null
-
hasPermission
boolean hasPermission(@Nonnull Permission... permissions)
Checks whether or not this PermissionHolder has the givenPermissions
in the Guild.- Parameters:
permissions
- Permissions to check for.- Returns:
- True, if all of the specified Permissions are granted to this PermissionHolder.
-
hasPermission
boolean hasPermission(@Nonnull Collection<Permission> permissions)
Checks whether or not this PermissionHolder has thePermissions
in the providedCollection<Permission>
in the Guild.- Parameters:
permissions
- Permissions to check for.- Returns:
- True, if all of the specified Permissions are granted to this PermissionHolder.
- See Also:
EnumSet
-
hasPermission
boolean hasPermission(@Nonnull GuildChannel channel, @Nonnull Permission... permissions)
Checks whether or not this PermissionHolder has the givenPermissions
in the specified GuildChannel.- Parameters:
channel
- TheGuildChannel
in which to check.permissions
- Permissions to check for.- Returns:
- True, if all of the specified Permissions are granted to this PermissionHolder in the provided GuildChannel.
- See Also:
EnumSet
-
hasPermission
boolean hasPermission(@Nonnull GuildChannel channel, @Nonnull Collection<Permission> permissions)
Checks whether or not this PermissionHolder has thePermissions
in the providedCollection<Permission>
in the specified GuildChannel.- Parameters:
channel
- TheGuildChannel
in which to check.permissions
- Permissions to check for.- Returns:
- True, if all of the specified Permissions are granted to this PermissionHolder in the provided GuildChannel.
-
-