Java Code Examples for net.dv8tion.jda.api.entities.Role#getPositionRaw()
The following examples show how to use
net.dv8tion.jda.api.entities.Role#getPositionRaw() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RoleImpl.java From JDA with Apache License 2.0 | 6 votes |
@Override public int compareTo(@Nonnull Role r) { if (this == r) return 0; if (!(r instanceof RoleImpl)) throw new IllegalArgumentException("Cannot compare different role implementations"); RoleImpl impl = (RoleImpl) r; if (this.guild.getIdLong() != impl.guild.getIdLong()) throw new IllegalArgumentException("Cannot compare roles that aren't from the same guild!"); if (this.getPositionRaw() != r.getPositionRaw()) return this.getPositionRaw() - r.getPositionRaw(); OffsetDateTime thisTime = this.getTimeCreated(); OffsetDateTime rTime = r.getTimeCreated(); //We compare the provided role's time to this's time instead of the reverse as one would expect due to how // discord deals with hierarchy. The more recent a role was created, the lower its hierarchy ranking when // it shares the same position as another role. return rTime.compareTo(thisTime); }
Example 2
Source File: RoleUpdatePositionEvent.java From JDA with Apache License 2.0 | 4 votes |
public RoleUpdatePositionEvent(@Nonnull JDA api, long responseNumber, @Nonnull Role role, int oldPosition, int oldPositionRaw) { super(api, responseNumber, role, oldPosition, role.getPosition(), IDENTIFIER); this.oldPositionRaw = oldPositionRaw; this.newPositionRaw = role.getPositionRaw(); }