2011-07-18 22:06:02 +02:00
|
|
|
package com.massivecraft.factions.struct;
|
2011-02-06 13:36:11 +01:00
|
|
|
|
|
|
|
import org.bukkit.ChatColor;
|
2011-07-18 22:06:02 +02:00
|
|
|
|
|
|
|
import com.massivecraft.factions.Conf;
|
2011-02-06 13:36:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
public enum Relation {
|
|
|
|
MEMBER(3, "member"),
|
|
|
|
ALLY(2, "ally"),
|
|
|
|
NEUTRAL(1, "neutral"),
|
|
|
|
ENEMY(0, "enemy");
|
|
|
|
|
|
|
|
public final int value;
|
|
|
|
public final String nicename;
|
|
|
|
|
|
|
|
private Relation(final int value, final String nicename) {
|
|
|
|
this.value = value;
|
|
|
|
this.nicename = nicename;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return this.nicename;
|
|
|
|
}
|
|
|
|
|
2011-07-09 08:36:18 +02:00
|
|
|
public boolean isMember() {
|
|
|
|
return this == Relation.MEMBER;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isAlly() {
|
|
|
|
return this == Relation.ALLY;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isNeutral() {
|
|
|
|
return this == Relation.NEUTRAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isEnemy() {
|
|
|
|
return this == Relation.ENEMY;
|
|
|
|
}
|
|
|
|
|
2011-08-02 02:59:48 +02:00
|
|
|
public boolean isAtLeast(Relation relation) {
|
|
|
|
return this.value >= relation.value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isAtMost(Relation relation) {
|
|
|
|
return this.value <= relation.value;
|
|
|
|
}
|
|
|
|
|
2011-02-06 13:36:11 +01:00
|
|
|
public ChatColor getColor() {
|
2011-02-12 18:05:05 +01:00
|
|
|
if (this == Relation.MEMBER) {
|
|
|
|
return Conf.colorMember;
|
|
|
|
} else if (this == Relation.ALLY) {
|
|
|
|
return Conf.colorAlly;
|
|
|
|
} else if (this == Relation.NEUTRAL) {
|
|
|
|
return Conf.colorNeutral;
|
2011-08-02 02:59:48 +02:00
|
|
|
} else {
|
2011-02-12 18:05:05 +01:00
|
|
|
return Conf.colorEnemy;
|
|
|
|
}
|
2011-02-06 13:36:11 +01:00
|
|
|
}
|
|
|
|
}
|