Interface PermissionOverride

All Superinterfaces:
ISnowflake

public interface PermissionOverride extends ISnowflake
Represents the specific Member or Role permission overrides that can be set for channels.
See Also:
  • Method Details

    • getAllowedRaw

      long getAllowedRaw()
      This is the raw binary representation (as a base 10 long) of the permissions allowed by this override.
      The long relates to the offsets used by each Permission.
      Returns:
      Never-negative long containing the binary representation of the allowed permissions of this override.
    • getInheritRaw

      long getInheritRaw()
      This is the raw binary representation (as a base 10 long) of the permissions not affected by this override.
      The long relates to the offsets used by each Permission.
      Returns:
      Never-negative long containing the binary representation of the unaffected permissions of this override.
    • getDeniedRaw

      long getDeniedRaw()
      This is the raw binary representation (as a base 10 long) of the permissions denied by this override.
      The long relates to the offsets used by each Permission.
      Returns:
      Never-negative long containing the binary representation of the denied permissions of this override.
    • getAllowed

      @Nonnull EnumSet<Permission> getAllowed()
      EnumSet of all Permissions that are specifically allowed by this override.
      Changes to the returned set do not affect this entity directly.
      Returns:
      Possibly-empty set of allowed Permissions.
    • getInherit

      @Nonnull EnumSet<Permission> getInherit()
      EnumSet of all Permission that are unaffected by this override.
      Changes to the returned set do not affect this entity directly.
      Returns:
      Possibly-empty set of unaffected Permissions.
    • getDenied

      EnumSet of all Permissions that are denied by this override.
      Changes to the returned set do not affect this entity directly.
      Returns:
      Possibly-empty set of denied Permissions.
    • getJDA

      @Nonnull JDA getJDA()
      The JDA instance that this PermissionOverride is related to.
      Returns:
      Never-null JDA instance.
    • getPermissionHolder

      @Nullable IPermissionHolder getPermissionHolder()
      This method will return the PermissionHolder of this PermissionOverride. It can be used to get the general permissions of that PermissionHolder, no matter if it is a Member or a Role.
      Similar to getMember() this will return null if the member is not cached.

      To get the concrete Member or Role, use getMember() or getRole()!

      Returns:
      Possibly-null IPermissionHolder of this PermissionOverride.
      See Also:
    • getMember

      @Nullable Member getMember()
      If this PermissionOverride is an override dealing with a Member, then this method will return the related Member if the member is currently cached.
      Otherwise, this method returns null.
      Basically: if isMemberOverride() returns false or the member is not cached, this returns null.
      Returns:
      Possibly-null related Member.
    • getRole

      @Nullable Role getRole()
      If this PermissionOverride is an override dealing with a Role, then this method will return the related Role.
      Otherwise, this method returns null.
      Basically: if isRoleOverride() returns false, this returns null.
      Returns:
      Possibly-null related Role.
    • getChannel

      The GuildChannel that this PermissionOverride affects.
      Returns:
      Never-null related GuildChannel that this override is part of.
    • getGuild

      @Nonnull Guild getGuild()
      The Guild that the GuildChannel returned from getChannel() is a part of. By inference, this is the Guild that this PermissionOverride is part of.
      Returns:
      Never-null related Guild.
    • isMemberOverride

      boolean isMemberOverride()
      Used to determine if this PermissionOverride relates to a specific Member.
      Returns:
      True if this override is a user override.
    • isRoleOverride

      boolean isRoleOverride()
      Used to determine if this PermissionOverride relates to a specific Role.
      Returns:
      True if this override is a role override.
    • getManager

      Returns the PermissionOverrideAction to modify this PermissionOverride.
      In the PermissionOverrideAction you can modify the permissions of the override. You modify multiple fields in one request by chaining setters before calling RestAction.queue().
      Returns:
      The PermissionOverrideAction of this override.
      Throws:
      InsufficientPermissionException - If the currently logged in account does not have Permission.MANAGE_PERMISSIONS
    • delete

      Deletes this PermissionOverride.

      Possible ErrorResponses include:

      Returns:
      AuditableRestAction
      Throws:
      InsufficientPermissionException - if we don't have the permission to MANAGE_CHANNEL