Saber-Factions/src/main/java/com/massivecraft/factions/struct/Role.java

43 lines
866 B
Java
Raw Normal View History

2011-07-18 22:06:02 +02:00
package com.massivecraft.factions.struct;
2011-02-06 13:36:11 +01:00
2011-07-18 22:06:02 +02:00
import com.massivecraft.factions.Conf;
2014-04-04 20:55:21 +02:00
public enum Role {
ADMIN(2, "admin"),
MODERATOR(1, "moderator"),
NORMAL(0, "normal member");
public final int value;
public final String nicename;
private Role(final int value, final String nicename) {
2014-07-01 22:10:18 +02:00
this.value = value;
this.nicename = nicename;
2014-04-04 20:55:21 +02:00
}
public boolean isAtLeast(Role role) {
return this.value >= role.value;
}
public boolean isAtMost(Role role) {
return this.value <= role.value;
}
@Override
public String toString() {
return this.nicename;
}
public String getPrefix() {
if (this == Role.ADMIN) {
return Conf.prefixAdmin;
}
if (this == Role.MODERATOR) {
return Conf.prefixMod;
}
return "";
}
2011-02-06 13:36:11 +01:00
}