Merged Relation and Role into one enum
This commit is contained in:
@ -9,7 +9,7 @@ public enum Permission
|
||||
MANAGE_SAFE_ZONE("managesafezone"),
|
||||
MANAGE_WAR_ZONE("managewarzone"),
|
||||
OWNERSHIP_BYPASS("ownershipbypass"),
|
||||
ADMIN("admin"),
|
||||
LEADER("leader"),
|
||||
AUTOCLAIM("autoclaim"),
|
||||
BYPASS("bypass"),
|
||||
CHAT("chat"),
|
||||
@ -30,7 +30,7 @@ public enum Permission
|
||||
LIST("list"),
|
||||
LOCK("lock"),
|
||||
MAP("map"),
|
||||
MOD("mod"),
|
||||
OFFICER("officer"),
|
||||
MONEY_BALANCE("money.balance"),
|
||||
MONEY_BALANCE_ANY("money.balance.any"),
|
||||
MONEY_DEPOSIT("money.deposit"),
|
||||
|
@ -95,12 +95,12 @@ public enum Rel
|
||||
{
|
||||
if (this == LEADER)
|
||||
{
|
||||
return Conf.prefixAdmin;
|
||||
return Conf.prefixLeader;
|
||||
}
|
||||
|
||||
if (this == OFFICER)
|
||||
{
|
||||
return Conf.prefixMod;
|
||||
return Conf.prefixOfficer;
|
||||
}
|
||||
|
||||
return "";
|
||||
@ -116,4 +116,69 @@ public enum Rel
|
||||
else
|
||||
return Conf.econCostNeutral;
|
||||
}
|
||||
|
||||
// return appropriate Conf setting for DenyBuild based on this relation and their online status
|
||||
public boolean confDenyBuild(boolean online)
|
||||
{
|
||||
if (this == MEMBER)
|
||||
return false;
|
||||
|
||||
if (online)
|
||||
{
|
||||
if (this == ENEMY)
|
||||
return Conf.territoryEnemyDenyBuild;
|
||||
else if (this == ALLY)
|
||||
return Conf.territoryAllyDenyBuild;
|
||||
else
|
||||
return Conf.territoryDenyBuild;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this == ENEMY)
|
||||
return Conf.territoryEnemyDenyBuildWhenOffline;
|
||||
else if (this == ALLY)
|
||||
return Conf.territoryAllyDenyBuildWhenOffline;
|
||||
else
|
||||
return Conf.territoryDenyBuildWhenOffline;
|
||||
}
|
||||
}
|
||||
|
||||
// return appropriate Conf setting for PainBuild based on this relation and their online status
|
||||
public boolean confPainBuild(boolean online)
|
||||
{
|
||||
if (this == MEMBER)
|
||||
return false;
|
||||
|
||||
if (online)
|
||||
{
|
||||
if (this == ENEMY)
|
||||
return Conf.territoryEnemyPainBuild;
|
||||
else if (this == ALLY)
|
||||
return Conf.territoryAllyPainBuild;
|
||||
else
|
||||
return Conf.territoryPainBuild;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this == ENEMY)
|
||||
return Conf.territoryEnemyPainBuildWhenOffline;
|
||||
else if (this == ALLY)
|
||||
return Conf.territoryAllyPainBuildWhenOffline;
|
||||
else
|
||||
return Conf.territoryPainBuildWhenOffline;
|
||||
}
|
||||
}
|
||||
|
||||
// return appropriate Conf setting for DenyUseage based on this relation
|
||||
public boolean confDenyUseage()
|
||||
{
|
||||
if (this == MEMBER)
|
||||
return false;
|
||||
else if (this == ENEMY)
|
||||
return Conf.territoryEnemyDenyUseage;
|
||||
else if (this == ALLY)
|
||||
return Conf.territoryAllyDenyUseage;
|
||||
else
|
||||
return Conf.territoryDenyUseage;
|
||||
}
|
||||
}
|
||||
|
@ -1,147 +0,0 @@
|
||||
package com.massivecraft.factions.struct;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
|
||||
|
||||
public enum RelationDEPR
|
||||
{
|
||||
MEMBER(3, "member"),
|
||||
ALLY(2, "ally"),
|
||||
NEUTRAL(1, "neutral"),
|
||||
ENEMY(0, "enemy"),
|
||||
;
|
||||
|
||||
public final int value;
|
||||
public final String nicename;
|
||||
|
||||
private RelationDEPR(final int value, final String nicename)
|
||||
{
|
||||
this.value = value;
|
||||
this.nicename = nicename;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.nicename;
|
||||
}
|
||||
|
||||
public boolean isMember()
|
||||
{
|
||||
return this == MEMBER;
|
||||
}
|
||||
|
||||
public boolean isAlly()
|
||||
{
|
||||
return this == ALLY;
|
||||
}
|
||||
|
||||
public boolean isNeutral()
|
||||
{
|
||||
return this == NEUTRAL;
|
||||
}
|
||||
|
||||
public boolean isEnemy()
|
||||
{
|
||||
return this == ENEMY;
|
||||
}
|
||||
|
||||
public boolean isAtLeast(Relation relation)
|
||||
{
|
||||
return this.value >= relation.value;
|
||||
}
|
||||
|
||||
public boolean isAtMost(Relation relation)
|
||||
{
|
||||
return this.value <= relation.value;
|
||||
}
|
||||
|
||||
public ChatColor getColor()
|
||||
{
|
||||
if (this == MEMBER)
|
||||
return Conf.colorMember;
|
||||
else if (this == ALLY)
|
||||
return Conf.colorAlly;
|
||||
else if (this == NEUTRAL)
|
||||
return Conf.colorNeutral;
|
||||
else
|
||||
return Conf.colorEnemy;
|
||||
}
|
||||
|
||||
// return appropriate Conf setting for DenyBuild based on this relation and their online status
|
||||
public boolean confDenyBuild(boolean online)
|
||||
{
|
||||
if (isMember())
|
||||
return false;
|
||||
|
||||
if (online)
|
||||
{
|
||||
if (isEnemy())
|
||||
return Conf.territoryEnemyDenyBuild;
|
||||
else if (isAlly())
|
||||
return Conf.territoryAllyDenyBuild;
|
||||
else
|
||||
return Conf.territoryDenyBuild;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isEnemy())
|
||||
return Conf.territoryEnemyDenyBuildWhenOffline;
|
||||
else if (isAlly())
|
||||
return Conf.territoryAllyDenyBuildWhenOffline;
|
||||
else
|
||||
return Conf.territoryDenyBuildWhenOffline;
|
||||
}
|
||||
}
|
||||
|
||||
// return appropriate Conf setting for PainBuild based on this relation and their online status
|
||||
public boolean confPainBuild(boolean online)
|
||||
{
|
||||
if (isMember())
|
||||
return false;
|
||||
|
||||
if (online)
|
||||
{
|
||||
if (isEnemy())
|
||||
return Conf.territoryEnemyPainBuild;
|
||||
else if (isAlly())
|
||||
return Conf.territoryAllyPainBuild;
|
||||
else
|
||||
return Conf.territoryPainBuild;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isEnemy())
|
||||
return Conf.territoryEnemyPainBuildWhenOffline;
|
||||
else if (isAlly())
|
||||
return Conf.territoryAllyPainBuildWhenOffline;
|
||||
else
|
||||
return Conf.territoryPainBuildWhenOffline;
|
||||
}
|
||||
}
|
||||
|
||||
// return appropriate Conf setting for DenyUseage based on this relation
|
||||
public boolean confDenyUseage()
|
||||
{
|
||||
if (isMember())
|
||||
return false;
|
||||
else if (isEnemy())
|
||||
return Conf.territoryEnemyDenyUseage;
|
||||
else if (isAlly())
|
||||
return Conf.territoryAllyDenyUseage;
|
||||
else
|
||||
return Conf.territoryDenyUseage;
|
||||
}
|
||||
|
||||
public double getRelationCost()
|
||||
{
|
||||
if (isEnemy())
|
||||
return Conf.econCostEnemy;
|
||||
else if (isAlly())
|
||||
return Conf.econCostAlly;
|
||||
else
|
||||
return Conf.econCostNeutral;
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
package com.massivecraft.factions.struct;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
|
||||
public enum RoleDEPR
|
||||
{
|
||||
ADMIN(2, "admin"),
|
||||
MODERATOR(1, "moderator"),
|
||||
NORMAL(0, "normal member");
|
||||
|
||||
public final int value;
|
||||
public final String nicename;
|
||||
|
||||
private RoleDEPR(final int value, final String nicename)
|
||||
{
|
||||
this.value = value;
|
||||
this.nicename = nicename;
|
||||
}
|
||||
|
||||
public boolean isAtLeast(Role role)
|
||||
{
|
||||
return this.value >= role.value;
|
||||
}
|
||||
|
||||
public boolean isAtMost(Role role)
|
||||
{
|
||||
return this.value <= role.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.nicename;
|
||||
}
|
||||
|
||||
public String getPrefix()
|
||||
{
|
||||
if (this == Role.ADMIN)
|
||||
{
|
||||
return Conf.prefixAdmin;
|
||||
}
|
||||
|
||||
if (this == Role.MODERATOR)
|
||||
{
|
||||
return Conf.prefixMod;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user