public class RoleImpl extends java.lang.Object implements Role
Constructor and Description |
---|
RoleImpl(java.lang.String id,
Guild guild) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Role r) |
RestAction<java.lang.Void> |
delete() |
boolean |
equals(java.lang.Object o) |
java.lang.String |
getAsMention()
Retrieve a Mention for this Entity.
|
java.awt.Color |
getColor()
The color this
Role is displayed in. |
Guild |
getGuild()
Returns the
Guild this Role exists in |
java.lang.String |
getId()
The Snowflake id of this entity.
|
JDA |
getJDA()
Returns the
JDA instance of this Role |
RoleManager |
getManager()
Returns the
RoleManager for this Role. |
RoleManagerUpdatable |
getManagerUpdatable() |
java.lang.String |
getName()
The Name of the
Role . |
java.util.List<Permission> |
getPermissions()
A list of the literal
Permissions that this Role has.NOTE: these do not necessarily represent the permissions this role will have in a Channel . |
long |
getPermissionsRaw()
|
int |
getPosition()
|
int |
getPositionRaw()
The actual position of the
Role as stored and given by Discord. |
int |
hashCode() |
boolean |
hasPermission(Channel channel,
java.util.Collection<Permission> permissions)
Checks if this
Role has access to the Permissions
in the provided Collection<Permission> in the specified Channel . |
boolean |
hasPermission(Channel channel,
Permission... permissions)
|
boolean |
hasPermission(java.util.Collection<Permission> permissions)
Checks if this
Role has access to the Permissions
in the provided Collection<Permission>This does not check the Channel-specific override Permissions . |
boolean |
hasPermission(Permission... permissions)
Checks if this
Role has access to the provided Permissions . |
boolean |
isHoisted()
Is this
Role hoisted?Members in a hoisted role are displayed in their own grouping on the user-list |
boolean |
isManaged()
Is this
Role managed?(Via plugins like Twitch). |
boolean |
isMentionable()
Returns wheter or not this Role is mentionable
|
RoleImpl |
setColor(java.awt.Color color) |
RoleImpl |
setHoisted(boolean hoisted) |
RoleImpl |
setManaged(boolean managed) |
RoleImpl |
setMentionable(boolean mentionable) |
RoleImpl |
setName(java.lang.String name) |
RoleImpl |
setRawPermissions(long rawPermissions) |
RoleImpl |
setRawPosition(int rawPosition) |
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getCreationTime
public RoleImpl(java.lang.String id, Guild guild)
public int getPosition()
Role
Role
in the Guild
hierarchy.Role
always return -1.getPosition
in interface Role
Role
as integer.public int getPositionRaw()
Role
Role
as stored and given by Discord.
Role positions are actually based on a pairing of the creation time (as stored in the snowflake id)
and the position. If 2 or more roles share the same position then they are sorted based on their creation date.
The more recent a role was created, the lower it is in the heirarchy. This is handled by Role.getPosition()
and it is most likely the method you want. If, for some reason, you want the actual position of the
Role then this method will give you that value.getPositionRaw
in interface Role
Role
.public java.lang.String getName()
Role
Role
.public boolean isManaged()
Role
Role
managed?public boolean isHoisted()
Role
Role
hoisted?public boolean isMentionable()
Role
isMentionable
in interface Role
public long getPermissionsRaw()
Role
long
representation of the literal permissions that this Role
has.Channel
.getPermissionsRaw
in interface Role
public java.util.List<Permission> getPermissions()
Role
Permissions
that this Role
has.Channel
.getPermissions
in interface Role
public java.awt.Color getColor()
Role
Role
is displayed in.public boolean hasPermission(Permission... permissions)
Role
Role
has access to the provided Permissions
.
This does not check the Channel-specific override Permissions
.
NOTE: this is not the same as Role.getPermissions()
.contains(Permission)
as it does effective permission calculations. The correct usage of this method is to determine if a Role has
the ability to do something.
hasPermission
in interface Role
permissions
- The Permissions
to check forPermissions
are available to this Role
public boolean hasPermission(java.util.Collection<Permission> permissions)
Role
Role
has access to the Permissions
in the provided Collection<Permission>Permissions
.
NOTE: this is not the same as Role.getPermissions()
.contains(Permission)
as it does effective permission calculations. The correct usage of this method is to determine if a Role has
the ability to do something.
hasPermission
in interface Role
permissions
- The Permissions
to check forPermissions
are available to this Role
public boolean hasPermission(Channel channel, Permission... permissions)
Role
hasPermission
in interface Role
permissions
- The Permissions
to check forPermissions
are available to this Role
in this Channelpublic boolean hasPermission(Channel channel, java.util.Collection<Permission> permissions)
Role
Role
has access to the Permissions
in the provided Collection<Permission> in the specified Channel
.hasPermission
in interface Role
permissions
- The Permissions
to check forPermissions
are available to this Role
in this Channelpublic Guild getGuild()
Role
Guild
this Role exists inpublic RoleManager getManager()
Role
RoleManager
for this Role.
In the RoleManager, you can modify all its values.getManager
in interface Role
public RoleManagerUpdatable getManagerUpdatable()
getManagerUpdatable
in interface Role
public RestAction<java.lang.Void> delete()
public JDA getJDA()
Role
JDA
instance of this Rolepublic java.lang.String getAsMention()
IMentionable
getAsMention
in interface IMentionable
public java.lang.String getId()
ISnowflake
getId
in interface ISnowflake
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(Role r)
compareTo
in interface java.lang.Comparable<Role>
public RoleImpl setName(java.lang.String name)
public RoleImpl setColor(java.awt.Color color)
public RoleImpl setManaged(boolean managed)
public RoleImpl setHoisted(boolean hoisted)
public RoleImpl setMentionable(boolean mentionable)
public RoleImpl setRawPermissions(long rawPermissions)
public RoleImpl setRawPosition(int rawPosition)