From 842844969b58fdf5075d089ba2c0f63c913c54ef Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Sun, 23 Oct 2011 17:55:53 +0200 Subject: [PATCH] Merged Relation and Role into one enum --- plugin.yml | 12 +- src/com/massivecraft/factions/Conf.java | 8 +- src/com/massivecraft/factions/Faction.java | 2 +- src/com/massivecraft/factions/P.java | 5 +- .../factions/cmd/CmdAutoClaim.java | 4 +- .../massivecraft/factions/cmd/CmdBoom.java | 4 +- .../massivecraft/factions/cmd/CmdBypass.java | 4 +- .../massivecraft/factions/cmd/CmdChat.java | 4 +- .../massivecraft/factions/cmd/CmdClaim.java | 4 +- .../massivecraft/factions/cmd/CmdConfig.java | 4 +- .../massivecraft/factions/cmd/CmdCreate.java | 4 +- .../factions/cmd/CmdDeinvite.java | 4 +- .../factions/cmd/CmdDescription.java | 4 +- .../massivecraft/factions/cmd/CmdDisband.java | 4 +- .../massivecraft/factions/cmd/CmdHelp.java | 8 +- .../massivecraft/factions/cmd/CmdHome.java | 4 +- .../massivecraft/factions/cmd/CmdInvite.java | 4 +- .../massivecraft/factions/cmd/CmdJoin.java | 4 +- .../massivecraft/factions/cmd/CmdKick.java | 4 +- .../cmd/{CmdAdmin.java => CmdLeader.java} | 12 +- .../massivecraft/factions/cmd/CmdLeave.java | 4 +- .../massivecraft/factions/cmd/CmdList.java | 4 +- .../massivecraft/factions/cmd/CmdLock.java | 4 +- src/com/massivecraft/factions/cmd/CmdMap.java | 4 +- .../massivecraft/factions/cmd/CmdMoney.java | 4 +- .../factions/cmd/CmdMoneyBalance.java | 4 +- .../factions/cmd/CmdMoneyDeposit.java | 4 +- .../factions/cmd/CmdMoneyTransferFf.java | 4 +- .../factions/cmd/CmdMoneyTransferFp.java | 4 +- .../factions/cmd/CmdMoneyTransferPf.java | 4 +- .../factions/cmd/CmdMoneyWithdraw.java | 4 +- .../cmd/{CmdMod.java => CmdOfficer.java} | 12 +- .../massivecraft/factions/cmd/CmdOpen.java | 4 +- .../massivecraft/factions/cmd/CmdOwner.java | 4 +- .../factions/cmd/CmdOwnerList.java | 4 +- .../factions/cmd/CmdPeaceful.java | 4 +- .../factions/cmd/CmdPermanent.java | 4 +- .../factions/cmd/CmdPermanentPower.java | 4 +- .../massivecraft/factions/cmd/CmdPower.java | 4 +- .../massivecraft/factions/cmd/CmdReload.java | 4 +- .../factions/cmd/CmdSafeunclaimall.java | 4 +- .../massivecraft/factions/cmd/CmdSaveAll.java | 4 +- .../massivecraft/factions/cmd/CmdSethome.java | 4 +- .../massivecraft/factions/cmd/CmdShow.java | 4 +- src/com/massivecraft/factions/cmd/CmdTag.java | 4 +- .../massivecraft/factions/cmd/CmdTitle.java | 4 +- .../massivecraft/factions/cmd/CmdUnclaim.java | 4 +- .../factions/cmd/CmdUnclaimall.java | 4 +- .../massivecraft/factions/cmd/CmdVersion.java | 4 +- .../factions/cmd/CmdWarunclaimall.java | 4 +- .../massivecraft/factions/cmd/FCmdRoot.java | 12 +- .../massivecraft/factions/cmd/FCommand.java | 14 +- .../factions/cmd/FRelationCommand.java | 4 +- .../factions/integration/SpoutFeatures.java | 25 ++- .../integration/capi/PluginCapiListener.java | 4 +- .../listeners/FactionsBlockListener.java | 6 +- .../listeners/FactionsChatEarlyListener.java | 4 +- .../listeners/FactionsEntityListener.java | 10 +- .../listeners/FactionsPlayerListener.java | 16 +- .../factions/struct/Permission.java | 4 +- src/com/massivecraft/factions/struct/Rel.java | 69 +++++++- .../factions/struct/RelationDEPR.java | 147 ------------------ .../factions/struct/RoleDEPR.java | 50 ------ .../factions/util/MyRelTypeAdapter.java | 21 +++ 64 files changed, 254 insertions(+), 363 deletions(-) rename src/com/massivecraft/factions/cmd/{CmdAdmin.java => CmdLeader.java} (84%) rename src/com/massivecraft/factions/cmd/{CmdMod.java => CmdOfficer.java} (84%) delete mode 100644 src/com/massivecraft/factions/struct/RelationDEPR.java delete mode 100644 src/com/massivecraft/factions/struct/RoleDEPR.java create mode 100644 src/com/massivecraft/factions/util/MyRelTypeAdapter.java diff --git a/plugin.yml b/plugin.yml index e04fc585..9b71c006 100644 --- a/plugin.yml +++ b/plugin.yml @@ -48,7 +48,7 @@ permissions: factions.kit.halfplayer: description: Can do all but create factions. children: - factions.admin: true + factions.leader: true factions.autoclaim: true factions.chat: true factions.claim: true @@ -63,7 +63,7 @@ permissions: factions.leave: true factions.list: true factions.map: true - factions.mod: true + factions.officer: true factions.money.kit.standard: true factions.noboom: true factions.open: true @@ -79,8 +79,8 @@ permissions: factions.version: true factions.unclaim: true factions.unclaimall: true - factions.admin: - description: hand over your admin rights + factions.leader: + description: hand over your leader rights factions.autoclaim: description: auto-claim land as you walk around factions.bypass: @@ -125,8 +125,8 @@ permissions: description: claim land as a war zone and build/destroy within war zones factions.map: description: show the territory map, and set optional auto update - factions.mod: - description: give or revoke moderator rights + factions.officer: + description: give or revoke officer rights factions.money.balance: description: show your factions current money balance factions.money.balance.any: diff --git a/src/com/massivecraft/factions/Conf.java b/src/com/massivecraft/factions/Conf.java index fff1c4e2..0ca6287f 100644 --- a/src/com/massivecraft/factions/Conf.java +++ b/src/com/massivecraft/factions/Conf.java @@ -30,8 +30,8 @@ public class Conf public static double powerOfflineLossLimit = 0.0; // players will no longer lose power from being offline once their power drops to this amount or less public static double powerFactionMax = 0.0; // if greater than 0, the cap on how much power a faction can have (additional power from players beyond that will act as a "buffer" of sorts) - public static String prefixAdmin = "**"; - public static String prefixMod = "*"; + public static String prefixLeader = "**"; + public static String prefixOfficer = "*"; public static int factionTagLengthMin = 3; public static int factionTagLengthMax = 10; @@ -181,8 +181,8 @@ public class Conf // Spout features public static boolean spoutFactionTagsOverNames = true; // show faction tags over names over player heads public static boolean spoutFactionTitlesOverNames = true; // whether to include player's title in that - public static boolean spoutFactionAdminCapes = true; // Show capes on faction admins, colored based on the viewer's relation to the target player - public static boolean spoutFactionModeratorCapes = true; // same, but for faction moderators + public static boolean spoutFactionLeaderCapes = true; // Show capes on faction admins, colored based on the viewer's relation to the target player + public static boolean spoutFactionOfficerCapes = true; // same, but for faction moderators public static int spoutTerritoryDisplayPosition = 3; // permanent territory display, instead of by chat; 0 = disabled, 1 = top left, 2 = top center, 3+ = top right public static float spoutTerritoryDisplaySize = 1.0f; // text scale (size) for territory display public static boolean spoutTerritoryDisplayShowDescription = true; // whether to show the faction description, not just the faction tag diff --git a/src/com/massivecraft/factions/Faction.java b/src/com/massivecraft/factions/Faction.java index 26dcee35..9f2f233b 100644 --- a/src/com/massivecraft/factions/Faction.java +++ b/src/com/massivecraft/factions/Faction.java @@ -348,7 +348,7 @@ public class Faction extends Entity implements EconomyParticipator return ret; } - public FPlayer getFPlayerAdmin() + public FPlayer getFPlayerLeader() { if ( ! this.isNormal()) return null; diff --git a/src/com/massivecraft/factions/P.java b/src/com/massivecraft/factions/P.java index ac6324eb..5eaf0cdb 100644 --- a/src/com/massivecraft/factions/P.java +++ b/src/com/massivecraft/factions/P.java @@ -24,8 +24,10 @@ import com.massivecraft.factions.listeners.FactionsEntityListener; import com.massivecraft.factions.listeners.FactionsPlayerListener; import com.massivecraft.factions.listeners.FactionsServerListener; import com.massivecraft.factions.struct.ChatMode; +import com.massivecraft.factions.struct.Rel; import com.massivecraft.factions.util.MapFLocToStringSetTypeAdapter; import com.massivecraft.factions.util.MyLocationTypeAdapter; +import com.massivecraft.factions.util.MyRelTypeAdapter; import com.massivecraft.factions.zcore.MPlugin; import com.nijiko.permissions.PermissionHandler; @@ -148,7 +150,8 @@ public class P extends MPlugin .disableHtmlEscaping() .excludeFieldsWithModifiers(Modifier.TRANSIENT, Modifier.VOLATILE) .registerTypeAdapter(Location.class, new MyLocationTypeAdapter()) - .registerTypeAdapter(mapFLocToStringSetType, new MapFLocToStringSetTypeAdapter()); + .registerTypeAdapter(mapFLocToStringSetType, new MapFLocToStringSetTypeAdapter()) + .registerTypeAdapter(Rel.class, new MyRelTypeAdapter()); } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdAutoClaim.java b/src/com/massivecraft/factions/cmd/CmdAutoClaim.java index d07ad4e0..dd35fe69 100644 --- a/src/com/massivecraft/factions/cmd/CmdAutoClaim.java +++ b/src/com/massivecraft/factions/cmd/CmdAutoClaim.java @@ -18,8 +18,8 @@ public class CmdAutoClaim extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdBoom.java b/src/com/massivecraft/factions/cmd/CmdBoom.java index 7c54ea7f..8775ded2 100644 --- a/src/com/massivecraft/factions/cmd/CmdBoom.java +++ b/src/com/massivecraft/factions/cmd/CmdBoom.java @@ -18,8 +18,8 @@ public class CmdBoom extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = true; - senderMustBeAdmin = false; + senderMustBeOfficer = true; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdBypass.java b/src/com/massivecraft/factions/cmd/CmdBypass.java index 5e626d60..a6b7a465 100644 --- a/src/com/massivecraft/factions/cmd/CmdBypass.java +++ b/src/com/massivecraft/factions/cmd/CmdBypass.java @@ -18,8 +18,8 @@ public class CmdBypass extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdChat.java b/src/com/massivecraft/factions/cmd/CmdChat.java index 645fb26e..25b4c203 100644 --- a/src/com/massivecraft/factions/cmd/CmdChat.java +++ b/src/com/massivecraft/factions/cmd/CmdChat.java @@ -21,8 +21,8 @@ public class CmdChat extends FCommand senderMustBePlayer = true; senderMustBeMember = true; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdClaim.java b/src/com/massivecraft/factions/cmd/CmdClaim.java index 4d4cd9ce..5f97105d 100644 --- a/src/com/massivecraft/factions/cmd/CmdClaim.java +++ b/src/com/massivecraft/factions/cmd/CmdClaim.java @@ -19,8 +19,8 @@ public class CmdClaim extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; aliases.add("claim"); } diff --git a/src/com/massivecraft/factions/cmd/CmdConfig.java b/src/com/massivecraft/factions/cmd/CmdConfig.java index 337cf30d..6a42ec83 100644 --- a/src/com/massivecraft/factions/cmd/CmdConfig.java +++ b/src/com/massivecraft/factions/cmd/CmdConfig.java @@ -32,8 +32,8 @@ public class CmdConfig extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdCreate.java b/src/com/massivecraft/factions/cmd/CmdCreate.java index 5550ca9f..71752590 100644 --- a/src/com/massivecraft/factions/cmd/CmdCreate.java +++ b/src/com/massivecraft/factions/cmd/CmdCreate.java @@ -25,8 +25,8 @@ public class CmdCreate extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdDeinvite.java b/src/com/massivecraft/factions/cmd/CmdDeinvite.java index 1f41f088..96b1f5df 100644 --- a/src/com/massivecraft/factions/cmd/CmdDeinvite.java +++ b/src/com/massivecraft/factions/cmd/CmdDeinvite.java @@ -20,8 +20,8 @@ public class CmdDeinvite extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = true; - senderMustBeAdmin = false; + senderMustBeOfficer = true; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdDescription.java b/src/com/massivecraft/factions/cmd/CmdDescription.java index 404b503e..9b7015f6 100644 --- a/src/com/massivecraft/factions/cmd/CmdDescription.java +++ b/src/com/massivecraft/factions/cmd/CmdDescription.java @@ -22,8 +22,8 @@ public class CmdDescription extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = true; - senderMustBeAdmin = false; + senderMustBeOfficer = true; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdDisband.java b/src/com/massivecraft/factions/cmd/CmdDisband.java index 09269933..e401cf84 100644 --- a/src/com/massivecraft/factions/cmd/CmdDisband.java +++ b/src/com/massivecraft/factions/cmd/CmdDisband.java @@ -24,8 +24,8 @@ public class CmdDisband extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdHelp.java b/src/com/massivecraft/factions/cmd/CmdHelp.java index f4387631..9c74a0b9 100644 --- a/src/com/massivecraft/factions/cmd/CmdHelp.java +++ b/src/com/massivecraft/factions/cmd/CmdHelp.java @@ -26,8 +26,8 @@ public class CmdHelp extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override @@ -105,8 +105,8 @@ public class CmdHelp extends FCommand pageLines.add( p.cmdBase.cmdUnclaim.getUseageTemplate(true) ); pageLines.add( p.cmdBase.cmdUnclaimall.getUseageTemplate(true) ); pageLines.add( p.cmdBase.cmdKick.getUseageTemplate(true) ); - pageLines.add( p.cmdBase.cmdMod.getUseageTemplate(true) ); - pageLines.add( p.cmdBase.cmdAdmin.getUseageTemplate(true) ); + pageLines.add( p.cmdBase.cmdOfficer.getUseageTemplate(true) ); + pageLines.add( p.cmdBase.cmdLeader.getUseageTemplate(true) ); pageLines.add( p.cmdBase.cmdTitle.getUseageTemplate(true) ); pageLines.add( p.txt.parse("Player titles are just for fun. No rules connected to them." )); helpPages.add(pageLines); diff --git a/src/com/massivecraft/factions/cmd/CmdHome.java b/src/com/massivecraft/factions/cmd/CmdHome.java index 74e37f3c..bb688f57 100644 --- a/src/com/massivecraft/factions/cmd/CmdHome.java +++ b/src/com/massivecraft/factions/cmd/CmdHome.java @@ -33,8 +33,8 @@ public class CmdHome extends FCommand senderMustBePlayer = true; senderMustBeMember = true; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdInvite.java b/src/com/massivecraft/factions/cmd/CmdInvite.java index 9a1f187c..93bf370e 100644 --- a/src/com/massivecraft/factions/cmd/CmdInvite.java +++ b/src/com/massivecraft/factions/cmd/CmdInvite.java @@ -20,8 +20,8 @@ public class CmdInvite extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = true; - senderMustBeAdmin = false; + senderMustBeOfficer = true; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdJoin.java b/src/com/massivecraft/factions/cmd/CmdJoin.java index bfe80358..5ec7bea6 100644 --- a/src/com/massivecraft/factions/cmd/CmdJoin.java +++ b/src/com/massivecraft/factions/cmd/CmdJoin.java @@ -19,8 +19,8 @@ public class CmdJoin extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdKick.java b/src/com/massivecraft/factions/cmd/CmdKick.java index 8dbbca99..51ac8d57 100644 --- a/src/com/massivecraft/factions/cmd/CmdKick.java +++ b/src/com/massivecraft/factions/cmd/CmdKick.java @@ -22,8 +22,8 @@ public class CmdKick extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = true; - senderMustBeAdmin = false; + senderMustBeOfficer = true; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdAdmin.java b/src/com/massivecraft/factions/cmd/CmdLeader.java similarity index 84% rename from src/com/massivecraft/factions/cmd/CmdAdmin.java rename to src/com/massivecraft/factions/cmd/CmdLeader.java index 48e2202c..47293549 100644 --- a/src/com/massivecraft/factions/cmd/CmdAdmin.java +++ b/src/com/massivecraft/factions/cmd/CmdLeader.java @@ -5,23 +5,23 @@ import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Rel; -public class CmdAdmin extends FCommand +public class CmdLeader extends FCommand { - public CmdAdmin() + public CmdLeader() { super(); - this.aliases.add("admin"); + this.aliases.add("leader"); this.requiredArgs.add("player name"); //this.optionalArgs.put("", ""); - this.permission = Permission.ADMIN.node; + this.permission = Permission.LEADER.node; this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = true; + senderMustBeOfficer = false; + senderMustBeLeader = true; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdLeave.java b/src/com/massivecraft/factions/cmd/CmdLeave.java index 7cb11c17..c2136ef6 100644 --- a/src/com/massivecraft/factions/cmd/CmdLeave.java +++ b/src/com/massivecraft/factions/cmd/CmdLeave.java @@ -17,8 +17,8 @@ public class CmdLeave extends FCommand { senderMustBePlayer = true; senderMustBeMember = true; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdList.java b/src/com/massivecraft/factions/cmd/CmdList.java index bc4da1e0..12e68aa0 100644 --- a/src/com/massivecraft/factions/cmd/CmdList.java +++ b/src/com/massivecraft/factions/cmd/CmdList.java @@ -27,8 +27,8 @@ public class CmdList extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdLock.java b/src/com/massivecraft/factions/cmd/CmdLock.java index 16d4206e..cae5dbb1 100644 --- a/src/com/massivecraft/factions/cmd/CmdLock.java +++ b/src/com/massivecraft/factions/cmd/CmdLock.java @@ -24,8 +24,8 @@ public class CmdLock extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdMap.java b/src/com/massivecraft/factions/cmd/CmdMap.java index aac8ac11..605a9d7d 100644 --- a/src/com/massivecraft/factions/cmd/CmdMap.java +++ b/src/com/massivecraft/factions/cmd/CmdMap.java @@ -21,8 +21,8 @@ public class CmdMap extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdMoney.java b/src/com/massivecraft/factions/cmd/CmdMoney.java index d7762079..14813895 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoney.java +++ b/src/com/massivecraft/factions/cmd/CmdMoney.java @@ -23,8 +23,8 @@ public class CmdMoney extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; this.setHelpShort("faction money commands"); this.helpLong.add(p.txt.parseTags("The faction money commands.")); diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyBalance.java b/src/com/massivecraft/factions/cmd/CmdMoneyBalance.java index cbbbad09..df7b9e6e 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyBalance.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyBalance.java @@ -20,8 +20,8 @@ public class CmdMoneyBalance extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyDeposit.java b/src/com/massivecraft/factions/cmd/CmdMoneyDeposit.java index a4a69071..91b1104e 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyDeposit.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyDeposit.java @@ -22,8 +22,8 @@ public class CmdMoneyDeposit extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java b/src/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java index 08615c01..3b497398 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java @@ -22,8 +22,8 @@ public class CmdMoneyTransferFf extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java b/src/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java index 30435a87..677e4dbb 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java @@ -22,8 +22,8 @@ public class CmdMoneyTransferFp extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java b/src/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java index ac1af4bb..0bf4817b 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java @@ -22,8 +22,8 @@ public class CmdMoneyTransferPf extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java b/src/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java index 2b588d17..3579875d 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java @@ -19,8 +19,8 @@ public class CmdMoneyWithdraw extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdMod.java b/src/com/massivecraft/factions/cmd/CmdOfficer.java similarity index 84% rename from src/com/massivecraft/factions/cmd/CmdMod.java rename to src/com/massivecraft/factions/cmd/CmdOfficer.java index 55715763..06829383 100644 --- a/src/com/massivecraft/factions/cmd/CmdMod.java +++ b/src/com/massivecraft/factions/cmd/CmdOfficer.java @@ -4,24 +4,24 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Rel; -public class CmdMod extends FCommand +public class CmdOfficer extends FCommand { - public CmdMod() + public CmdOfficer() { super(); - this.aliases.add("mod"); + this.aliases.add("officer"); this.requiredArgs.add("player name"); //this.optionalArgs.put("", ""); - this.permission = Permission.MOD.node; + this.permission = Permission.OFFICER.node; this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = true; + senderMustBeOfficer = false; + senderMustBeLeader = true; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdOpen.java b/src/com/massivecraft/factions/cmd/CmdOpen.java index fac92821..0f95a872 100644 --- a/src/com/massivecraft/factions/cmd/CmdOpen.java +++ b/src/com/massivecraft/factions/cmd/CmdOpen.java @@ -20,8 +20,8 @@ public class CmdOpen extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = true; - senderMustBeAdmin = false; + senderMustBeOfficer = true; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdOwner.java b/src/com/massivecraft/factions/cmd/CmdOwner.java index ce008949..b0a5da48 100644 --- a/src/com/massivecraft/factions/cmd/CmdOwner.java +++ b/src/com/massivecraft/factions/cmd/CmdOwner.java @@ -26,8 +26,8 @@ public class CmdOwner extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } // TODO: Fix colors! diff --git a/src/com/massivecraft/factions/cmd/CmdOwnerList.java b/src/com/massivecraft/factions/cmd/CmdOwnerList.java index f7c39efc..3f95b256 100644 --- a/src/com/massivecraft/factions/cmd/CmdOwnerList.java +++ b/src/com/massivecraft/factions/cmd/CmdOwnerList.java @@ -22,8 +22,8 @@ public class CmdOwnerList extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdPeaceful.java b/src/com/massivecraft/factions/cmd/CmdPeaceful.java index 0750996f..eb7ba39e 100644 --- a/src/com/massivecraft/factions/cmd/CmdPeaceful.java +++ b/src/com/massivecraft/factions/cmd/CmdPeaceful.java @@ -22,8 +22,8 @@ public class CmdPeaceful extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdPermanent.java b/src/com/massivecraft/factions/cmd/CmdPermanent.java index 3061253d..dd152ce9 100644 --- a/src/com/massivecraft/factions/cmd/CmdPermanent.java +++ b/src/com/massivecraft/factions/cmd/CmdPermanent.java @@ -21,8 +21,8 @@ public class CmdPermanent extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdPermanentPower.java b/src/com/massivecraft/factions/cmd/CmdPermanentPower.java index ff275c26..5a8cb105 100644 --- a/src/com/massivecraft/factions/cmd/CmdPermanentPower.java +++ b/src/com/massivecraft/factions/cmd/CmdPermanentPower.java @@ -19,8 +19,8 @@ public class CmdPermanentPower extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdPower.java b/src/com/massivecraft/factions/cmd/CmdPower.java index 3085dfe1..909f5507 100644 --- a/src/com/massivecraft/factions/cmd/CmdPower.java +++ b/src/com/massivecraft/factions/cmd/CmdPower.java @@ -21,8 +21,8 @@ public class CmdPower extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdReload.java b/src/com/massivecraft/factions/cmd/CmdReload.java index 2aae4132..b3c2cddf 100644 --- a/src/com/massivecraft/factions/cmd/CmdReload.java +++ b/src/com/massivecraft/factions/cmd/CmdReload.java @@ -23,8 +23,8 @@ public class CmdReload extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdSafeunclaimall.java b/src/com/massivecraft/factions/cmd/CmdSafeunclaimall.java index 16cc36e5..2075700c 100644 --- a/src/com/massivecraft/factions/cmd/CmdSafeunclaimall.java +++ b/src/com/massivecraft/factions/cmd/CmdSafeunclaimall.java @@ -20,8 +20,8 @@ public class CmdSafeunclaimall extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; this.setHelpShort("Unclaim all safezone land"); } diff --git a/src/com/massivecraft/factions/cmd/CmdSaveAll.java b/src/com/massivecraft/factions/cmd/CmdSaveAll.java index bf0e85bd..407c5b50 100644 --- a/src/com/massivecraft/factions/cmd/CmdSaveAll.java +++ b/src/com/massivecraft/factions/cmd/CmdSaveAll.java @@ -23,8 +23,8 @@ public class CmdSaveAll extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdSethome.java b/src/com/massivecraft/factions/cmd/CmdSethome.java index 522025c9..0e3546a3 100644 --- a/src/com/massivecraft/factions/cmd/CmdSethome.java +++ b/src/com/massivecraft/factions/cmd/CmdSethome.java @@ -21,8 +21,8 @@ public class CmdSethome extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdShow.java b/src/com/massivecraft/factions/cmd/CmdShow.java index 789dcccb..7605aa90 100644 --- a/src/com/massivecraft/factions/cmd/CmdShow.java +++ b/src/com/massivecraft/factions/cmd/CmdShow.java @@ -26,8 +26,8 @@ public class CmdShow extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdTag.java b/src/com/massivecraft/factions/cmd/CmdTag.java index 47c37e43..42348a74 100644 --- a/src/com/massivecraft/factions/cmd/CmdTag.java +++ b/src/com/massivecraft/factions/cmd/CmdTag.java @@ -24,8 +24,8 @@ public class CmdTag extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = true; - senderMustBeAdmin = false; + senderMustBeOfficer = true; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdTitle.java b/src/com/massivecraft/factions/cmd/CmdTitle.java index 5cbade02..8b4ed912 100644 --- a/src/com/massivecraft/factions/cmd/CmdTitle.java +++ b/src/com/massivecraft/factions/cmd/CmdTitle.java @@ -20,8 +20,8 @@ public class CmdTitle extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = true; - senderMustBeAdmin = false; + senderMustBeOfficer = true; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdUnclaim.java b/src/com/massivecraft/factions/cmd/CmdUnclaim.java index 40ce24d5..c04a161e 100644 --- a/src/com/massivecraft/factions/cmd/CmdUnclaim.java +++ b/src/com/massivecraft/factions/cmd/CmdUnclaim.java @@ -24,8 +24,8 @@ public class CmdUnclaim extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdUnclaimall.java b/src/com/massivecraft/factions/cmd/CmdUnclaimall.java index 0a6a73af..74fbfa88 100644 --- a/src/com/massivecraft/factions/cmd/CmdUnclaimall.java +++ b/src/com/massivecraft/factions/cmd/CmdUnclaimall.java @@ -21,8 +21,8 @@ public class CmdUnclaimall extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = true; - senderMustBeAdmin = false; + senderMustBeOfficer = true; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdVersion.java b/src/com/massivecraft/factions/cmd/CmdVersion.java index 8614cf51..e9bfae94 100644 --- a/src/com/massivecraft/factions/cmd/CmdVersion.java +++ b/src/com/massivecraft/factions/cmd/CmdVersion.java @@ -18,8 +18,8 @@ public class CmdVersion extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdWarunclaimall.java b/src/com/massivecraft/factions/cmd/CmdWarunclaimall.java index 4caac2eb..f5dd33de 100644 --- a/src/com/massivecraft/factions/cmd/CmdWarunclaimall.java +++ b/src/com/massivecraft/factions/cmd/CmdWarunclaimall.java @@ -20,8 +20,8 @@ public class CmdWarunclaimall extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; this.setHelpShort("unclaim all warzone land"); } diff --git a/src/com/massivecraft/factions/cmd/FCmdRoot.java b/src/com/massivecraft/factions/cmd/FCmdRoot.java index 0b3cbad0..7576bfb2 100644 --- a/src/com/massivecraft/factions/cmd/FCmdRoot.java +++ b/src/com/massivecraft/factions/cmd/FCmdRoot.java @@ -6,7 +6,7 @@ import com.massivecraft.factions.Conf; public class FCmdRoot extends FCommand { - public CmdAdmin cmdAdmin = new CmdAdmin(); + public CmdLeader cmdLeader = new CmdLeader(); public CmdAutoClaim cmdAutoClaim = new CmdAutoClaim(); public CmdBoom cmdBoom = new CmdBoom(); public CmdBypass cmdBypass = new CmdBypass(); @@ -26,7 +26,7 @@ public class FCmdRoot extends FCommand public CmdList cmdList = new CmdList(); public CmdLock cmdLock = new CmdLock(); public CmdMap cmdMap = new CmdMap(); - public CmdMod cmdMod = new CmdMod(); + public CmdOfficer cmdOfficer = new CmdOfficer(); public CmdMoney cmdMoney = new CmdMoney(); public CmdOpen cmdOpen = new CmdOpen(); public CmdOwner cmdOwner = new CmdOwner(); @@ -62,8 +62,8 @@ public class FCmdRoot extends FCommand senderMustBePlayer = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; this.disableOnLock = false; @@ -72,7 +72,7 @@ public class FCmdRoot extends FCommand //this.subCommands.add(p.cmdHelp); - this.addSubCommand(this.cmdAdmin); + this.addSubCommand(this.cmdLeader); this.addSubCommand(this.cmdAutoClaim); this.addSubCommand(this.cmdBoom); this.addSubCommand(this.cmdBypass); @@ -92,7 +92,7 @@ public class FCmdRoot extends FCommand this.addSubCommand(this.cmdList); this.addSubCommand(this.cmdLock); this.addSubCommand(this.cmdMap); - this.addSubCommand(this.cmdMod); + this.addSubCommand(this.cmdOfficer); this.addSubCommand(this.cmdMoney); this.addSubCommand(this.cmdOpen); this.addSubCommand(this.cmdOwner); diff --git a/src/com/massivecraft/factions/cmd/FCommand.java b/src/com/massivecraft/factions/cmd/FCommand.java index 89518137..63bd4e8c 100644 --- a/src/com/massivecraft/factions/cmd/FCommand.java +++ b/src/com/massivecraft/factions/cmd/FCommand.java @@ -23,8 +23,8 @@ public abstract class FCommand extends MCommand

public FPlayer fme; public Faction myFaction; public boolean senderMustBeMember; - public boolean senderMustBeModerator; - public boolean senderMustBeAdmin; + public boolean senderMustBeOfficer; + public boolean senderMustBeLeader; public boolean isMoneyCommand; @@ -39,8 +39,8 @@ public abstract class FCommand extends MCommand

isMoneyCommand = false; senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; + senderMustBeOfficer = false; + senderMustBeLeader = false; } @Override @@ -89,7 +89,7 @@ public abstract class FCommand extends MCommand

boolean superValid = super.validSenderType(sender, informSenderIfNot); if ( ! superValid) return false; - if ( ! (this.senderMustBeMember || this.senderMustBeModerator || this.senderMustBeAdmin)) return true; + if ( ! (this.senderMustBeMember || this.senderMustBeOfficer || this.senderMustBeLeader)) return true; if ( ! (sender instanceof Player)) return false; @@ -101,13 +101,13 @@ public abstract class FCommand extends MCommand

return false; } - if (this.senderMustBeModerator && ! fplayer.getRole().isAtLeast(Rel.OFFICER)) + if (this.senderMustBeOfficer && ! fplayer.getRole().isAtLeast(Rel.OFFICER)) { sender.sendMessage(p.txt.parse("Only faction moderators can %s.", this.getHelpShort())); return false; } - if (this.senderMustBeAdmin && ! fplayer.getRole().isAtLeast(Rel.LEADER)) + if (this.senderMustBeLeader && ! fplayer.getRole().isAtLeast(Rel.LEADER)) { sender.sendMessage(p.txt.parse("Only faction admins can %s.", this.getHelpShort())); return false; diff --git a/src/com/massivecraft/factions/cmd/FRelationCommand.java b/src/com/massivecraft/factions/cmd/FRelationCommand.java index f8980d79..fd850868 100644 --- a/src/com/massivecraft/factions/cmd/FRelationCommand.java +++ b/src/com/massivecraft/factions/cmd/FRelationCommand.java @@ -23,8 +23,8 @@ public abstract class FRelationCommand extends FCommand senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = true; - senderMustBeAdmin = false; + senderMustBeOfficer = true; + senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/integration/SpoutFeatures.java b/src/com/massivecraft/factions/integration/SpoutFeatures.java index 1eda111f..fbe60209 100644 --- a/src/com/massivecraft/factions/integration/SpoutFeatures.java +++ b/src/com/massivecraft/factions/integration/SpoutFeatures.java @@ -13,8 +13,7 @@ import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.Event; -import com.massivecraft.factions.struct.Relation; -import com.massivecraft.factions.struct.Role; +import com.massivecraft.factions.struct.Rel; import org.getspout.spoutapi.gui.Color; import org.getspout.spoutapi.player.AppearanceManager; @@ -222,7 +221,7 @@ public class SpoutFeatures SpoutPlayer sPlayer = SpoutManager.getPlayer(viewer.getPlayer()); Player pViewed = viewed.getPlayer(); String viewedTitle = viewed.getTitle(); - Role viewedRole = viewed.getRole(); + Rel viewedRole = viewed.getRole(); if ((Conf.spoutFactionTagsOverNames || Conf.spoutFactionTitlesOverNames) && viewer != viewed) { @@ -247,19 +246,19 @@ public class SpoutFeatures if ( ( - Conf.spoutFactionAdminCapes + Conf.spoutFactionLeaderCapes && - viewedRole.equals(Role.ADMIN) + viewedRole.equals(Rel.LEADER) ) || ( - Conf.spoutFactionModeratorCapes + Conf.spoutFactionOfficerCapes && - viewedRole.equals(Role.MODERATOR) + viewedRole.equals(Rel.OFFICER) ) ) { - Relation relation = viewer.getRelationTo(viewed); + Rel relation = viewer.getRelationTo(viewed); String cape = ""; if (!viewedFaction.isNormal()) { @@ -267,13 +266,13 @@ public class SpoutFeatures } else if (viewedFaction.isPeaceful()) cape = Conf.capePeaceful; - else if (relation.isNeutral()) + else if (relation == Rel.NEUTRAL) cape = Conf.capeNeutral; - else if (relation.isMember()) + else if (relation == Rel.MEMBER) cape = Conf.capeMember; - else if (relation.isEnemy()) + else if (relation == Rel.ENEMY) cape = Conf.capeEnemy; - else if (relation.isAlly()) + else if (relation == Rel.ALLY) cape = Conf.capeAlly; if (cape.isEmpty()) @@ -281,7 +280,7 @@ public class SpoutFeatures else spoutApp.setPlayerCloak(sPlayer, pViewed, cape); } - else if (Conf.spoutFactionAdminCapes || Conf.spoutFactionModeratorCapes) + else if (Conf.spoutFactionLeaderCapes || Conf.spoutFactionOfficerCapes) { spoutApp.resetPlayerCloak(sPlayer, pViewed); } diff --git a/src/com/massivecraft/factions/integration/capi/PluginCapiListener.java b/src/com/massivecraft/factions/integration/capi/PluginCapiListener.java index 316c9163..d0d5f0f9 100644 --- a/src/com/massivecraft/factions/integration/capi/PluginCapiListener.java +++ b/src/com/massivecraft/factions/integration/capi/PluginCapiListener.java @@ -17,7 +17,7 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Faction; import com.massivecraft.factions.P; -import com.massivecraft.factions.struct.Relation; +import com.massivecraft.factions.struct.Rel; public class PluginCapiListener extends CapiListener { @@ -81,7 +81,7 @@ public class PluginCapiListener extends CapiListener for (Player somePlayer : Bukkit.getServer().getOnlinePlayers()) { FPlayer someFPlayer = FPlayers.i.get(somePlayer); - if (someFPlayer.getRelationTo(fme).value >= Relation.ALLY.value) + if (someFPlayer.getRelationTo(fme).value >= Rel.ALLY.value) { event.getThem().add(somePlayer); } diff --git a/src/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/com/massivecraft/factions/listeners/FactionsBlockListener.java index 6d3285b2..e6997976 100644 --- a/src/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -19,7 +19,7 @@ import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Faction; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; -import com.massivecraft.factions.struct.Relation; +import com.massivecraft.factions.struct.Rel; public class FactionsBlockListener extends BlockListener @@ -151,7 +151,7 @@ public class FactionsBlockListener extends BlockListener return false; } - Relation rel = pistonFaction.getRelationTo(otherFaction); + Rel rel = pistonFaction.getRelationTo(otherFaction); if (rel.confDenyBuild(otherFaction.hasPlayersOnline())) return false; @@ -201,7 +201,7 @@ public class FactionsBlockListener extends BlockListener } Faction myFaction = me.getFaction(); - Relation rel = myFaction.getRelationTo(otherFaction); + Rel rel = myFaction.getRelationTo(otherFaction); boolean online = otherFaction.hasPlayersOnline(); boolean pain = !justCheck && rel.confPainBuild(online); boolean deny = rel.confDenyBuild(online); diff --git a/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java b/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java index 848c13bd..cb319970 100644 --- a/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsChatEarlyListener.java @@ -13,7 +13,7 @@ import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Faction; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.ChatMode; -import com.massivecraft.factions.struct.Relation; +import com.massivecraft.factions.struct.Rel; // this is an addtional PlayerListener for handling slashless command usage and faction chat, to be set at low priority so Factions gets to them first @@ -67,7 +67,7 @@ public class FactionsChatEarlyListener extends PlayerListener //Send to all our allies for (FPlayer fplayer : FPlayers.i.getOnline()) { - if(myFaction.getRelationTo(fplayer) == Relation.ALLY) + if(myFaction.getRelationTo(fplayer) == Rel.ALLY) fplayer.sendMessage(message); } diff --git a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java index b30bd91b..ddbdecb2 100644 --- a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -28,7 +28,7 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Faction; import com.massivecraft.factions.P; -import com.massivecraft.factions.struct.Relation; +import com.massivecraft.factions.struct.Rel; import com.massivecraft.factions.util.MiscUtil; @@ -321,10 +321,10 @@ public class FactionsEntityListener extends EntityListener return false; } - Relation relation = defendFaction.getRelationTo(attackFaction); + Rel relation = defendFaction.getRelationTo(attackFaction); // You can not hurt neutral factions - if (Conf.disablePVPBetweenNeutralFactions && relation.isNeutral()) + if (Conf.disablePVPBetweenNeutralFactions && relation == Rel.NEUTRAL) { attacker.msg("You can't hurt neutral factions. Declare them as an enemy."); return false; @@ -337,7 +337,7 @@ public class FactionsEntityListener extends EntityListener } // You can never hurt faction members or allies - if (relation.isMember() || relation.isAlly()) + if (relation == Rel.MEMBER || relation == Rel.ALLY) { attacker.msg("You can't hurt %s.", defender.describeTo(attacker)); return false; @@ -346,7 +346,7 @@ public class FactionsEntityListener extends EntityListener boolean ownTerritory = defender.isInOwnTerritory(); // You can not hurt neutrals in their own territory. - if (ownTerritory && relation.isNeutral()) + if (ownTerritory && relation == Rel.NEUTRAL) { attacker.msg("You can't hurt %s in their own territory unless you declare them as an enemy.", defender.describeTo(attacker)); defender.msg("%s tried to hurt you.", attacker.describeTo(defender, true)); diff --git a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java index fe52d493..f2a9f5c3 100644 --- a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -32,7 +32,7 @@ import com.massivecraft.factions.Factions; import com.massivecraft.factions.P; import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.struct.Permission; -import com.massivecraft.factions.struct.Relation; +import com.massivecraft.factions.struct.Rel; import com.massivecraft.factions.zcore.util.TextUtil; import java.util.logging.Level; @@ -376,7 +376,7 @@ public class FactionsPlayerListener extends PlayerListener } Faction myFaction = me.getFaction(); - Relation rel = myFaction.getRelationTo(otherFaction); + Rel rel = myFaction.getRelationTo(otherFaction); // Cancel if we are not in our own territory if (rel.confDenyUseage()) @@ -426,10 +426,10 @@ public class FactionsPlayerListener extends PlayerListener } Faction myFaction = me.getFaction(); - Relation rel = myFaction.getRelationTo(otherFaction); + Rel rel = myFaction.getRelationTo(otherFaction); // You may use any block unless it is another faction's territory... - if (rel.isNeutral() || (rel.isEnemy() && Conf.territoryEnemyProtectMaterials) || (rel.isAlly() && Conf.territoryAllyProtectMaterials)) + if (rel == Rel.NEUTRAL || (rel == Rel.ENEMY && Conf.territoryEnemyProtectMaterials) || (rel == Rel.ALLY && Conf.territoryAllyProtectMaterials)) { if (!justCheck) me.msg("You can't use %s in the territory of %s.", TextUtil.getMaterialName(material), otherFaction.getTag(myFaction)); @@ -529,8 +529,8 @@ public class FactionsPlayerListener extends PlayerListener return false; } - Relation rel = me.getRelationToLocation(); - if (rel.isAtLeast(Relation.ALLY)) + Rel rel = me.getRelationToLocation(); + if (rel.isAtLeast(Rel.ALLY)) { return false; } @@ -539,7 +539,7 @@ public class FactionsPlayerListener extends PlayerListener if ( - rel.isNeutral() + rel == Rel.NEUTRAL && ! Conf.territoryNeutralDenyCommands.isEmpty() && @@ -567,7 +567,7 @@ public class FactionsPlayerListener extends PlayerListener } else if ( - rel.isEnemy() + rel == Rel.ENEMY && ! Conf.territoryEnemyDenyCommands.isEmpty() && diff --git a/src/com/massivecraft/factions/struct/Permission.java b/src/com/massivecraft/factions/struct/Permission.java index 49a430e4..de2ccf91 100644 --- a/src/com/massivecraft/factions/struct/Permission.java +++ b/src/com/massivecraft/factions/struct/Permission.java @@ -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"), diff --git a/src/com/massivecraft/factions/struct/Rel.java b/src/com/massivecraft/factions/struct/Rel.java index 60db842a..ae8aea1f 100644 --- a/src/com/massivecraft/factions/struct/Rel.java +++ b/src/com/massivecraft/factions/struct/Rel.java @@ -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; + } } diff --git a/src/com/massivecraft/factions/struct/RelationDEPR.java b/src/com/massivecraft/factions/struct/RelationDEPR.java deleted file mode 100644 index 634c3387..00000000 --- a/src/com/massivecraft/factions/struct/RelationDEPR.java +++ /dev/null @@ -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; - } -} diff --git a/src/com/massivecraft/factions/struct/RoleDEPR.java b/src/com/massivecraft/factions/struct/RoleDEPR.java deleted file mode 100644 index 0aacf731..00000000 --- a/src/com/massivecraft/factions/struct/RoleDEPR.java +++ /dev/null @@ -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 ""; - } -} diff --git a/src/com/massivecraft/factions/util/MyRelTypeAdapter.java b/src/com/massivecraft/factions/util/MyRelTypeAdapter.java new file mode 100644 index 00000000..d9304c82 --- /dev/null +++ b/src/com/massivecraft/factions/util/MyRelTypeAdapter.java @@ -0,0 +1,21 @@ +package com.massivecraft.factions.util; + +import java.lang.reflect.Type; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; +import com.massivecraft.factions.struct.Rel; + +/** + * This is a legacy solution. Since Relation and Role enums have ben merged AND the rename ADMIN -> LEADER, MODERATOR -> OFFICER + */ +public class MyRelTypeAdapter implements JsonDeserializer +{ + @Override + public Rel deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException + { + return Rel.parse(json.getAsString()); + } +}