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) |
boolean |
equals(java.lang.Object o) |
java.lang.String |
getAsMention() |
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 |
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 . |
java.util.List<Permission> |
getPermissions(Channel channel) |
int |
getPermissionsRaw()
|
int |
getPosition()
|
int |
getPositionRaw()
The actual position of the
Role as stored and given by Discord. |
int |
hashCode() |
boolean |
hasPermission(Channel chanel,
Permission... permissions) |
boolean |
hasPermission(Permission... permissions)
Checks if this
Role has the provided
Guild level Permissions .This does not check the Channel-specific override Permissions . |
boolean |
isGrouped()
Is this
Role grouped?(Users with this Role are grouped in the online-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 |
setGrouped(boolean grouped) |
RoleImpl |
setManaged(boolean managed) |
RoleImpl |
setMentionable(boolean mentionable) |
RoleImpl |
setName(java.lang.String name) |
RoleImpl |
setRawPermissions(int 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 isGrouped()
Role
Role
grouped?public boolean isMentionable()
Role
isMentionable
in interface Role
public int getPermissionsRaw()
Role
int
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.util.List<Permission> getPermissions(Channel channel)
getPermissions
in interface Role
public java.awt.Color getColor()
Role
Role
is displayed in.public boolean hasPermission(Permission... permissions)
Role
Role
has the provided
Guild
level Permissions
.Permissions
.hasPermission
in interface Role
permissions
- The Permissions
to check forPermission
is available to this Role
public boolean hasPermission(Channel chanel, Permission... permissions)
hasPermission
in interface Role
public Guild getGuild()
Role
Guild
this Role exists inpublic JDA getJDA()
Role
JDA
instance of this Rolepublic java.lang.String getAsMention()
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 setGrouped(boolean grouped)
public RoleImpl setMentionable(boolean mentionable)
public RoleImpl setRawPermissions(int rawPermissions)
public RoleImpl setRawPosition(int rawPosition)