Use Lang for roles

This commit is contained in:
Trent Hensler 2018-01-31 16:49:19 -08:00
parent 9f08e6580b
commit 8484f92030

View File

@ -6,11 +6,11 @@ import org.bukkit.ChatColor;
public enum Relation { public enum Relation {
MEMBER(4, "member"), MEMBER(4, TL.RELATION_MEMBER_SINGULAR.toString()),
ALLY(3, "ally"), ALLY(3, TL.RELATION_ALLY_SINGULAR.toString()),
TRUCE(2, "truce"), TRUCE(2, TL.RELATION_TRUCE_SINGULAR.toString()),
NEUTRAL(1, "neutral"), NEUTRAL(1, TL.RELATION_NEUTRAL_SINGULAR.toString()),
ENEMY(0, "enemy"); ENEMY(0, TL.RELATION_ENEMY_SINGULAR.toString());
public final int value; public final int value;
public final String nicename; public final String nicename;
@ -27,13 +27,13 @@ public enum Relation {
public static Relation fromString(String s) { public static Relation fromString(String s) {
// Because Java 6 doesn't allow String switches :( // Because Java 6 doesn't allow String switches :(
if (s.equalsIgnoreCase("member")) { if (s.equalsIgnoreCase(MEMBER.nicename)) {
return MEMBER; return MEMBER;
} else if (s.equalsIgnoreCase("ally")) { } else if (s.equalsIgnoreCase(ALLY.nicename)) {
return ALLY; return ALLY;
} else if (s.equalsIgnoreCase("truce")) { } else if (s.equalsIgnoreCase(TRUCE.nicename)) {
return TRUCE; return TRUCE;
} else if (s.equalsIgnoreCase("enemy")) { } else if (s.equalsIgnoreCase(ENEMY.nicename)) {
return ENEMY; return ENEMY;
} else { } else {
return NEUTRAL; // If they somehow mess things up, go back to default behavior. return NEUTRAL; // If they somehow mess things up, go back to default behavior.