In progress: Using MassiveCraftCore and Allman indentation style and minor refactoring.

This commit is contained in:
Olof Larsson
2011-10-08 22:03:44 +02:00
parent 61998f459d
commit 0ce9cce9d3
75 changed files with 4605 additions and 2033 deletions

View File

@ -5,7 +5,8 @@ import org.bukkit.ChatColor;
import com.massivecraft.factions.Conf;
public enum Relation {
public enum Relation
{
MEMBER(3, "member"),
ALLY(2, "ally"),
NEUTRAL(1, "neutral"),
@ -20,107 +21,145 @@ public enum Relation {
}
@Override
public String toString() {
public String toString()
{
return this.nicename;
}
public boolean isMember() {
// TODO: Insane way to use enums!!!?
public boolean isMember()
{
return this.value == MEMBER.value;
}
public boolean isAlly() {
public boolean isAlly()
{
return this.value == ALLY.value;
}
public boolean isNeutral() {
public boolean isNeutral()
{
return this.value == NEUTRAL.value;
}
public boolean isEnemy() {
public boolean isEnemy()
{
return this.value == ENEMY.value;
}
public boolean isAtLeast(Relation relation) {
public boolean isAtLeast(Relation relation)
{
return this.value >= relation.value;
}
public boolean isAtMost(Relation relation) {
public boolean isAtMost(Relation relation)
{
return this.value <= relation.value;
}
public ChatColor getColor() {
if (this.value == MEMBER.value) {
public ChatColor getColor()
{
if (this.value == MEMBER.value)
{
return Conf.colorMember;
} else if (this.value == ALLY.value) {
}
else if (this.value == ALLY.value)
{
return Conf.colorAlly;
} else if (this.value == NEUTRAL.value) {
}
else if (this.value == NEUTRAL.value)
{
return Conf.colorNeutral;
} else {
}
else
{
return Conf.colorEnemy;
}
}
// return appropriate Conf setting for DenyBuild based on this relation and their online status
public boolean confDenyBuild(boolean online) {
if (online) {
if (isEnemy()) {
public boolean confDenyBuild(boolean online)
{
if (online)
{
if (isEnemy())
{
return Conf.territoryEnemyDenyBuild;
}
else if (isAlly()) {
else if (isAlly())
{
return Conf.territoryAllyDenyBuild;
}
else {
else
{
return Conf.territoryDenyBuild;
}
}
else {
if (isEnemy()) {
else
{
if (isEnemy())
{
return Conf.territoryEnemyDenyBuildWhenOffline;
}
else if (isAlly()) {
else if (isAlly())
{
return Conf.territoryAllyDenyBuildWhenOffline;
}
else {
else
{
return Conf.territoryDenyBuildWhenOffline;
}
}
}
// return appropriate Conf setting for PainBuild based on this relation and their online status
public boolean confPainBuild(boolean online) {
if (online) {
if (isEnemy()) {
public boolean confPainBuild(boolean online)
{
if (online)
{
if (isEnemy())
{
return Conf.territoryEnemyPainBuild;
}
else if (isAlly()) {
else if (isAlly())
{
return Conf.territoryAllyPainBuild;
}
else {
else
{
return Conf.territoryPainBuild;
}
}
else {
if (isEnemy()) {
else
{
if (isEnemy())
{
return Conf.territoryEnemyPainBuildWhenOffline;
}
else if (isAlly()) {
else if (isAlly())
{
return Conf.territoryAllyPainBuildWhenOffline;
}
else {
else
{
return Conf.territoryPainBuildWhenOffline;
}
}
}
// return appropriate Conf setting for DenyUseage based on this relation
public boolean confDenyUseage() {
if (isEnemy()) {
public boolean confDenyUseage()
{
if (isEnemy())
{
return Conf.territoryEnemyDenyUseage;
}
else if (isAlly()) {
else if (isAlly())
{
return Conf.territoryAllyDenyUseage;
}
else {
else
{
return Conf.territoryDenyUseage;
}
}