Reformat before I go crazy.
This commit is contained in:
@@ -1,40 +1,34 @@
|
||||
package com.massivecraft.factions.struct;
|
||||
|
||||
public enum ChatMode
|
||||
{
|
||||
FACTION(2, "faction chat"),
|
||||
ALLIANCE(1, "alliance chat"),
|
||||
PUBLIC(0, "public chat");
|
||||
|
||||
public final int value;
|
||||
public final String nicename;
|
||||
|
||||
private ChatMode(final int value, final String nicename)
|
||||
{
|
||||
this.value = value;
|
||||
this.nicename = nicename;
|
||||
}
|
||||
|
||||
public boolean isAtLeast(ChatMode role)
|
||||
{
|
||||
return this.value >= role.value;
|
||||
}
|
||||
|
||||
public boolean isAtMost(ChatMode role)
|
||||
{
|
||||
return this.value <= role.value;
|
||||
}
|
||||
public enum ChatMode {
|
||||
FACTION(2, "faction chat"),
|
||||
ALLIANCE(1, "alliance chat"),
|
||||
PUBLIC(0, "public chat");
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.nicename;
|
||||
}
|
||||
|
||||
public ChatMode getNext()
|
||||
{
|
||||
if (this == PUBLIC) return ALLIANCE;
|
||||
if (this == ALLIANCE)return FACTION;
|
||||
return PUBLIC;
|
||||
}
|
||||
public final int value;
|
||||
public final String nicename;
|
||||
|
||||
private ChatMode(final int value, final String nicename) {
|
||||
this.value = value;
|
||||
this.nicename = nicename;
|
||||
}
|
||||
|
||||
public boolean isAtLeast(ChatMode role) {
|
||||
return this.value >= role.value;
|
||||
}
|
||||
|
||||
public boolean isAtMost(ChatMode role) {
|
||||
return this.value <= role.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.nicename;
|
||||
}
|
||||
|
||||
public ChatMode getNext() {
|
||||
if (this == PUBLIC) return ALLIANCE;
|
||||
if (this == ALLIANCE) return FACTION;
|
||||
return PUBLIC;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,87 +1,81 @@
|
||||
package com.massivecraft.factions.struct;
|
||||
|
||||
import com.massivecraft.factions.P;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.P;
|
||||
public enum Permission {
|
||||
MANAGE_SAFE_ZONE("managesafezone"),
|
||||
MANAGE_WAR_ZONE("managewarzone"),
|
||||
OWNERSHIP_BYPASS("ownershipbypass"),
|
||||
ADMIN("admin"),
|
||||
ADMIN_ANY("admin.any"),
|
||||
AUTOCLAIM("autoclaim"),
|
||||
BYPASS("bypass"),
|
||||
CHAT("chat"),
|
||||
CHATSPY("chatspy"),
|
||||
CLAIM("claim"),
|
||||
CLAIM_RADIUS("claim.radius"),
|
||||
CONFIG("config"),
|
||||
CREATE("create"),
|
||||
DEINVITE("deinvite"),
|
||||
DESCRIPTION("description"),
|
||||
DISBAND("disband"),
|
||||
DISBAND_ANY("disband.any"),
|
||||
HELP("help"),
|
||||
HOME("home"),
|
||||
INVITE("invite"),
|
||||
JOIN("join"),
|
||||
JOIN_ANY("join.any"),
|
||||
JOIN_OTHERS("join.others"),
|
||||
KICK("kick"),
|
||||
KICK_ANY("kick.any"),
|
||||
LEAVE("leave"),
|
||||
LIST("list"),
|
||||
LOCK("lock"),
|
||||
MAP("map"),
|
||||
MOD("mod"),
|
||||
MOD_ANY("mod.any"),
|
||||
MONEY_BALANCE("money.balance"),
|
||||
MONEY_BALANCE_ANY("money.balance.any"),
|
||||
MONEY_DEPOSIT("money.deposit"),
|
||||
MONEY_WITHDRAW("money.withdraw"),
|
||||
MONEY_WITHDRAW_ANY("money.withdraw.any"),
|
||||
MONEY_F2F("money.f2f"),
|
||||
MONEY_F2P("money.f2p"),
|
||||
MONEY_P2F("money.p2f"),
|
||||
NO_BOOM("noboom"),
|
||||
OPEN("open"),
|
||||
OWNER("owner"),
|
||||
OWNERLIST("ownerlist"),
|
||||
SET_PEACEFUL("setpeaceful"),
|
||||
SET_PERMANENT("setpermanent"),
|
||||
SET_PERMANENTPOWER("setpermanentpower"),
|
||||
POWERBOOST("powerboost"),
|
||||
POWER("power"),
|
||||
POWER_ANY("power.any"),
|
||||
RELATION("relation"),
|
||||
RELOAD("reload"),
|
||||
SAVE("save"),
|
||||
SETHOME("sethome"),
|
||||
SETHOME_ANY("sethome.any"),
|
||||
SHOW("show"),
|
||||
TAG("tag"),
|
||||
TITLE("title"),
|
||||
UNCLAIM("unclaim"),
|
||||
UNCLAIM_ALL("unclaimall"),
|
||||
VERSION("version"),;
|
||||
|
||||
public enum Permission
|
||||
{
|
||||
MANAGE_SAFE_ZONE("managesafezone"),
|
||||
MANAGE_WAR_ZONE("managewarzone"),
|
||||
OWNERSHIP_BYPASS("ownershipbypass"),
|
||||
ADMIN("admin"),
|
||||
ADMIN_ANY("admin.any"),
|
||||
AUTOCLAIM("autoclaim"),
|
||||
BYPASS("bypass"),
|
||||
CHAT("chat"),
|
||||
CHATSPY("chatspy"),
|
||||
CLAIM("claim"),
|
||||
CLAIM_RADIUS("claim.radius"),
|
||||
CONFIG("config"),
|
||||
CREATE("create"),
|
||||
DEINVITE("deinvite"),
|
||||
DESCRIPTION("description"),
|
||||
DISBAND("disband"),
|
||||
DISBAND_ANY("disband.any"),
|
||||
HELP("help"),
|
||||
HOME("home"),
|
||||
INVITE("invite"),
|
||||
JOIN("join"),
|
||||
JOIN_ANY("join.any"),
|
||||
JOIN_OTHERS("join.others"),
|
||||
KICK("kick"),
|
||||
KICK_ANY("kick.any"),
|
||||
LEAVE("leave"),
|
||||
LIST("list"),
|
||||
LOCK("lock"),
|
||||
MAP("map"),
|
||||
MOD("mod"),
|
||||
MOD_ANY("mod.any"),
|
||||
MONEY_BALANCE("money.balance"),
|
||||
MONEY_BALANCE_ANY("money.balance.any"),
|
||||
MONEY_DEPOSIT("money.deposit"),
|
||||
MONEY_WITHDRAW("money.withdraw"),
|
||||
MONEY_WITHDRAW_ANY("money.withdraw.any"),
|
||||
MONEY_F2F("money.f2f"),
|
||||
MONEY_F2P("money.f2p"),
|
||||
MONEY_P2F("money.p2f"),
|
||||
NO_BOOM("noboom"),
|
||||
OPEN("open"),
|
||||
OWNER("owner"),
|
||||
OWNERLIST("ownerlist"),
|
||||
SET_PEACEFUL("setpeaceful"),
|
||||
SET_PERMANENT("setpermanent"),
|
||||
SET_PERMANENTPOWER("setpermanentpower"),
|
||||
POWERBOOST("powerboost"),
|
||||
POWER("power"),
|
||||
POWER_ANY("power.any"),
|
||||
RELATION("relation"),
|
||||
RELOAD("reload"),
|
||||
SAVE("save"),
|
||||
SETHOME("sethome"),
|
||||
SETHOME_ANY("sethome.any"),
|
||||
SHOW("show"),
|
||||
TAG("tag"),
|
||||
TITLE("title"),
|
||||
UNCLAIM("unclaim"),
|
||||
UNCLAIM_ALL("unclaimall"),
|
||||
VERSION("version"),
|
||||
;
|
||||
|
||||
public final String node;
|
||||
|
||||
Permission(final String node)
|
||||
{
|
||||
this.node = "factions."+node;
|
||||
}
|
||||
|
||||
public boolean has(CommandSender sender, boolean informSenderIfNot)
|
||||
{
|
||||
return P.p.perm.has(sender, this.node, informSenderIfNot);
|
||||
}
|
||||
|
||||
public boolean has(CommandSender sender)
|
||||
{
|
||||
return has(sender, false);
|
||||
}
|
||||
public final String node;
|
||||
|
||||
Permission(final String node) {
|
||||
this.node = "factions." + node;
|
||||
}
|
||||
|
||||
public boolean has(CommandSender sender, boolean informSenderIfNot) {
|
||||
return P.p.perm.has(sender, this.node, informSenderIfNot);
|
||||
}
|
||||
|
||||
public boolean has(CommandSender sender) {
|
||||
return has(sender, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,146 +1,125 @@
|
||||
package com.massivecraft.factions.struct;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
|
||||
public enum Relation {
|
||||
MEMBER(3, "member"),
|
||||
ALLY(2, "ally"),
|
||||
NEUTRAL(1, "neutral"),
|
||||
ENEMY(0, "enemy");
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
public final int value;
|
||||
public final String nicename;
|
||||
|
||||
// return appropriate Conf setting for DenyBuild based on this relation and their online status
|
||||
public boolean confDenyBuild(boolean online)
|
||||
{
|
||||
if (isMember())
|
||||
return false;
|
||||
private Relation(final int value, final String nicename) {
|
||||
this.value = value;
|
||||
this.nicename = nicename;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.nicename;
|
||||
}
|
||||
|
||||
// return appropriate Conf setting for PainBuild based on this relation and their online status
|
||||
public boolean confPainBuild(boolean online)
|
||||
{
|
||||
if (isMember())
|
||||
return false;
|
||||
public boolean isMember() {
|
||||
return this == MEMBER;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
public boolean isAlly() {
|
||||
return this == ALLY;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,49 +2,41 @@ package com.massivecraft.factions.struct;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
|
||||
public enum Role
|
||||
{
|
||||
ADMIN(2, "admin"),
|
||||
MODERATOR(1, "moderator"),
|
||||
NORMAL(0, "normal member");
|
||||
|
||||
public final int value;
|
||||
public final String nicename;
|
||||
|
||||
private Role(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;
|
||||
}
|
||||
public enum Role {
|
||||
ADMIN(2, "admin"),
|
||||
MODERATOR(1, "moderator"),
|
||||
NORMAL(0, "normal member");
|
||||
|
||||
@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 "";
|
||||
}
|
||||
public final int value;
|
||||
public final String nicename;
|
||||
|
||||
private Role(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