Role updates.

* Adds recruit role below the normal role.
* Adds /f promote and demote. Access to this command defaults to moderator if not set in /f perm
* Default role is still set to recruite. Will have to /f demote to set players to that rank.
This commit is contained in:
Trent Hensler
2018-01-04 17:17:26 -08:00
parent 4852ac6be4
commit 4db185e3ee
15 changed files with 152 additions and 16 deletions

View File

@@ -4,9 +4,10 @@ import com.massivecraft.factions.Conf;
import com.massivecraft.factions.zcore.util.TL;
public enum Role {
ADMIN(2, TL.ROLE_ADMIN),
MODERATOR(1, TL.ROLE_MODERATOR),
NORMAL(0, TL.ROLE_NORMAL);
ADMIN(3, TL.ROLE_ADMIN),
MODERATOR(2, TL.ROLE_MODERATOR),
NORMAL(1, TL.ROLE_NORMAL),
RECRUIT(0, TL.ROLE_RECRUIT);
public final int value;
public final String nicename;
@@ -26,6 +27,24 @@ public enum Role {
return this.value <= role.value;
}
public static Role getRelative(Role role, int relative) {
return Role.getByValue(role.value + relative);
}
public static Role getByValue(int value) {
switch (value) {
case 0:
return RECRUIT;
case 1:
return NORMAL;
case 2:
return MODERATOR;
case 3: return ADMIN;
}
return null;
}
@Override
public String toString() {
return this.nicename;
@@ -44,6 +63,14 @@ public enum Role {
return Conf.prefixMod;
}
if (this == Role.NORMAL) {
return Conf.prefixNormal;
}
if (this == Role.RECRUIT) {
return Conf.prefixRecruit;
}
return "";
}
}