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;
|
2011-02-12 18:05:05 +01:00
|
|
|
|
2011-10-21 20:08:54 +02:00
|
|
|
public enum Role
|
|
|
|
{
|
2011-02-06 13:36:11 +01:00
|
|
|
ADMIN(2, "admin"),
|
|
|
|
MODERATOR(1, "moderator"),
|
2011-03-11 05:14:39 +01:00
|
|
|
NORMAL(0, "normal member");
|
2011-02-06 13:36:11 +01:00
|
|
|
|
|
|
|
public final int value;
|
|
|
|
public final String nicename;
|
|
|
|
|
2011-10-21 20:08:54 +02:00
|
|
|
private Role(final int value, final String nicename)
|
|
|
|
{
|
2011-02-06 13:36:11 +01:00
|
|
|
this.value = value;
|
|
|
|
this.nicename = nicename;
|
|
|
|
}
|
|
|
|
|
2011-10-21 20:08:54 +02:00
|
|
|
public boolean isAtLeast(Role role)
|
|
|
|
{
|
2011-08-22 22:13:12 +02:00
|
|
|
return this.value >= role.value;
|
|
|
|
}
|
|
|
|
|
2011-10-21 20:08:54 +02:00
|
|
|
public boolean isAtMost(Role role)
|
|
|
|
{
|
2011-08-22 22:13:12 +02:00
|
|
|
return this.value <= role.value;
|
|
|
|
}
|
|
|
|
|
2011-02-06 13:36:11 +01:00
|
|
|
@Override
|
2011-10-21 20:08:54 +02:00
|
|
|
public String toString()
|
|
|
|
{
|
2011-02-06 13:36:11 +01:00
|
|
|
return this.nicename;
|
|
|
|
}
|
2011-02-12 18:05:05 +01:00
|
|
|
|
2011-10-21 20:08:54 +02:00
|
|
|
public String getPrefix()
|
|
|
|
{
|
|
|
|
if (this == Role.ADMIN)
|
|
|
|
{
|
2011-02-12 18:05:05 +01:00
|
|
|
return Conf.prefixAdmin;
|
|
|
|
}
|
|
|
|
|
2011-10-21 20:08:54 +02:00
|
|
|
if (this == Role.MODERATOR)
|
|
|
|
{
|
2011-02-12 18:05:05 +01:00
|
|
|
return Conf.prefixMod;
|
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
2011-02-06 13:36:11 +01:00
|
|
|
}
|