From a5c8e2de49c8b46f82351332ae9fd5b8d83bd8a1 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Sun, 9 Oct 2011 21:57:43 +0200 Subject: [PATCH] glerp --- plugin.yml | 241 +++++++++--------- src/com/massivecraft/factions/P.java | 10 +- .../factions/{commands => cmd}/CmdAdmin.java | 11 +- .../{commands => cmd}/CmdAutoClaim.java | 11 +- .../{commands => cmd}/CmdAutoSafeclaim.java | 9 +- .../{commands => cmd}/CmdAutoWarclaim.java | 13 +- .../{commands => cmd}/CmdBalance.java | 7 +- .../factions/{commands => cmd}/CmdBoom.java | 11 +- .../factions/{commands => cmd}/CmdBypass.java | 5 +- .../factions/{commands => cmd}/CmdChat.java | 5 +- .../factions/{commands => cmd}/CmdClaim.java | 11 +- .../factions/{commands => cmd}/CmdConfig.java | 11 +- .../factions/{commands => cmd}/CmdCreate.java | 11 +- .../{commands => cmd}/CmdDeinvite.java | 11 +- .../{commands => cmd}/CmdDeposit.java | 5 +- .../{commands => cmd}/CmdDescription.java | 11 +- .../{commands => cmd}/CmdDisband.java | 7 +- .../factions/{commands => cmd}/CmdHelp.java | 5 +- .../factions/{commands => cmd}/CmdHome.java | 5 +- .../factions/{commands => cmd}/CmdInvite.java | 11 +- .../factions/{commands => cmd}/CmdJoin.java | 11 +- .../factions/{commands => cmd}/CmdKick.java | 13 +- .../factions/{commands => cmd}/CmdLeave.java | 11 +- .../factions/{commands => cmd}/CmdList.java | 5 +- .../factions/{commands => cmd}/CmdLock.java | 9 +- .../factions/{commands => cmd}/CmdMap.java | 5 +- .../factions/{commands => cmd}/CmdMod.java | 11 +- .../factions/{commands => cmd}/CmdOpen.java | 11 +- .../factions/{commands => cmd}/CmdOwner.java | 11 +- .../{commands => cmd}/CmdOwnerList.java | 5 +- .../factions/{commands => cmd}/CmdPay.java | 8 +- .../{commands => cmd}/CmdPeaceful.java | 5 +- .../{commands => cmd}/CmdPermanent.java | 5 +- .../factions/{commands => cmd}/CmdPower.java | 7 +- .../{commands => cmd}/CmdRelationAlly.java | 2 +- .../{commands => cmd}/CmdRelationEnemy.java | 2 +- .../{commands => cmd}/CmdRelationNeutral.java | 2 +- .../factions/{commands => cmd}/CmdReload.java | 5 +- .../{commands => cmd}/CmdSafeclaim.java | 9 +- .../{commands => cmd}/CmdSafeunclaimall.java | 9 +- .../{commands => cmd}/CmdSaveAll.java | 5 +- .../{commands => cmd}/CmdSethome.java | 17 +- .../factions/{commands => cmd}/CmdShow.java | 5 +- .../factions/{commands => cmd}/CmdTag.java | 11 +- .../factions/{commands => cmd}/CmdTitle.java | 11 +- .../{commands => cmd}/CmdUnclaim.java | 11 +- .../{commands => cmd}/CmdUnclaimall.java | 11 +- .../{commands => cmd}/CmdVersion.java | 5 +- .../{commands => cmd}/CmdWarclaim.java | 9 +- .../{commands => cmd}/CmdWarunclaimall.java | 10 +- .../{commands => cmd}/CmdWithdraw.java | 5 +- .../factions/{commands => cmd}/FCmdRoot.java | 4 +- .../factions/{commands => cmd}/FCommand.java | 29 ++- .../{commands => cmd}/FRelationCommand.java | 11 +- .../factions/integration/Econ.java | 2 +- .../factions/struct/Permission.java | 115 ++++----- .../massivecraft/factions/zcore/MCommand.java | 13 +- .../massivecraft/factions/zcore/MPlugin.java | 7 +- .../factions/zcore/persist/SaveTask.java | 5 +- 59 files changed, 361 insertions(+), 482 deletions(-) rename src/com/massivecraft/factions/{commands => cmd}/CmdAdmin.java (89%) rename src/com/massivecraft/factions/{commands => cmd}/CmdAutoClaim.java (88%) rename src/com/massivecraft/factions/{commands => cmd}/CmdAutoSafeclaim.java (91%) rename src/com/massivecraft/factions/{commands => cmd}/CmdAutoWarclaim.java (89%) rename src/com/massivecraft/factions/{commands => cmd}/CmdBalance.java (85%) rename src/com/massivecraft/factions/{commands => cmd}/CmdBoom.java (87%) rename src/com/massivecraft/factions/{commands => cmd}/CmdBypass.java (89%) rename src/com/massivecraft/factions/{commands => cmd}/CmdChat.java (92%) rename src/com/massivecraft/factions/{commands => cmd}/CmdClaim.java (74%) rename src/com/massivecraft/factions/{commands => cmd}/CmdConfig.java (97%) rename src/com/massivecraft/factions/{commands => cmd}/CmdCreate.java (91%) rename src/com/massivecraft/factions/{commands => cmd}/CmdDeinvite.java (87%) rename src/com/massivecraft/factions/{commands => cmd}/CmdDeposit.java (93%) rename src/com/massivecraft/factions/{commands => cmd}/CmdDescription.java (87%) rename src/com/massivecraft/factions/{commands => cmd}/CmdDisband.java (89%) rename src/com/massivecraft/factions/{commands => cmd}/CmdHelp.java (98%) rename src/com/massivecraft/factions/{commands => cmd}/CmdHome.java (96%) rename src/com/massivecraft/factions/{commands => cmd}/CmdInvite.java (88%) rename src/com/massivecraft/factions/{commands => cmd}/CmdJoin.java (91%) rename src/com/massivecraft/factions/{commands => cmd}/CmdKick.java (92%) rename src/com/massivecraft/factions/{commands => cmd}/CmdLeave.java (72%) rename src/com/massivecraft/factions/{commands => cmd}/CmdList.java (95%) rename src/com/massivecraft/factions/{commands => cmd}/CmdLock.java (76%) rename src/com/massivecraft/factions/{commands => cmd}/CmdMap.java (92%) rename src/com/massivecraft/factions/{commands => cmd}/CmdMod.java (88%) rename src/com/massivecraft/factions/{commands => cmd}/CmdOpen.java (87%) rename src/com/massivecraft/factions/{commands => cmd}/CmdOwner.java (94%) rename src/com/massivecraft/factions/{commands => cmd}/CmdOwnerList.java (92%) rename src/com/massivecraft/factions/{commands => cmd}/CmdPay.java (93%) rename src/com/massivecraft/factions/{commands => cmd}/CmdPeaceful.java (88%) rename src/com/massivecraft/factions/{commands => cmd}/CmdPermanent.java (87%) rename src/com/massivecraft/factions/{commands => cmd}/CmdPower.java (83%) rename src/com/massivecraft/factions/{commands => cmd}/CmdRelationAlly.java (81%) rename src/com/massivecraft/factions/{commands => cmd}/CmdRelationEnemy.java (82%) rename src/com/massivecraft/factions/{commands => cmd}/CmdRelationNeutral.java (82%) rename src/com/massivecraft/factions/{commands => cmd}/CmdReload.java (89%) rename src/com/massivecraft/factions/{commands => cmd}/CmdSafeclaim.java (91%) rename src/com/massivecraft/factions/{commands => cmd}/CmdSafeunclaimall.java (87%) rename src/com/massivecraft/factions/{commands => cmd}/CmdSaveAll.java (83%) rename src/com/massivecraft/factions/{commands => cmd}/CmdSethome.java (82%) rename src/com/massivecraft/factions/{commands => cmd}/CmdShow.java (97%) rename src/com/massivecraft/factions/{commands => cmd}/CmdTag.java (92%) rename src/com/massivecraft/factions/{commands => cmd}/CmdTitle.java (88%) rename src/com/massivecraft/factions/{commands => cmd}/CmdUnclaim.java (95%) rename src/com/massivecraft/factions/{commands => cmd}/CmdUnclaimall.java (93%) rename src/com/massivecraft/factions/{commands => cmd}/CmdVersion.java (81%) rename src/com/massivecraft/factions/{commands => cmd}/CmdWarclaim.java (91%) rename src/com/massivecraft/factions/{commands => cmd}/CmdWarunclaimall.java (87%) rename src/com/massivecraft/factions/{commands => cmd}/CmdWithdraw.java (94%) rename src/com/massivecraft/factions/{commands => cmd}/FCmdRoot.java (96%) rename src/com/massivecraft/factions/{commands => cmd}/FCommand.java (94%) rename src/com/massivecraft/factions/{commands => cmd}/FRelationCommand.java (94%) diff --git a/plugin.yml b/plugin.yml index f4717f80..b8849af5 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,172 +1,169 @@ name: Factions version: 1.6.0_dev main: com.massivecraft.factions.P -softdepend: - - PermissionsEx - - Permissions - - Essentials - - EssentialsChat - - HeroChat - - iChat - - LocalAreaChat - - nChat - - ChatManager - - AuthMe - - iConomy - - Register - - Spout - - WorldEdit - - WorldGuard +authors: [Olof Larsson, Brett Flannigan] +softdepend: [PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, nChat, ChatManager, AuthMe, iConomy, Register, Spout, WorldEdit, WorldGuard] permissions: - factions.*: - description: Grants all Factions permissions + factions.kit.admin: + description: All faction permissions. children: - factions.*: - description: Grants all Factions permissions + factions.kit.mod: true + factions.config: true + factions.lock: true + factions.reload: true + factions.save: true + factions.kit.mod: + description: All faction permissions but configuration and persistance. children: - - - factions.managesafezone: - description: claim land as a safe zone and build/destroy within safe zones - default: op - factions.managewarzone: - description: claim land as a war zone and build/destroy within war zones - default: op - factions.ownershipbypass: - description: bypass ownership restrictions within own faction's territory - default: op - factions.command.admin: + factions.kit.halfmod: true + factions.disband.any: true + factions.setpermanent: true + factions.setpeaceful: true + factions.sethome.any: true + factions.kit.halfmod: + description: Zones, bypassing, and kicking + children: + factions.kit.fullplayer: true + factions.managesafezone: true + factions.managewarzone: true + factions.bypass: true + factions.kick.any: true + factions.ownershipbypass: true + factions.kit.fullplayer: + description: Can also create new factions. + children: + factions.kit.halfplayer: true + factions.create: true + factions.kit.halfplayer: + description: Can do all but create factions. + children: + factions.admin: true + factions.autoclaim: true + factions.balance: true + factions.balance.any: true + factions.withdraw: true + factions.pay: true + factions.chat: true + factions.claim: true + factions.deinvite: true + factions.deposit: true + factions.description: true + factions.disband: true + factions.help: true + factions.home: true + factions.join: true + factions.kick: true + factions.leave: true + factions.list: true + factions.map: true + factions.mod: true + factions.noboom: true + factions.open: true + factions.owner: true + factions.ownerlist: true + factions.power: true + factions.power.any: true + factions.relation: true + factions.sethome: true + factions.show: true + factions.tag: true + factions.title: true + factions.version: true + factions.unclaim: true + factions.unclaimall: true + factions.admin: description: hand over your admin rights - default: true - factions.command.autoclaim: + factions.autoclaim: description: auto-claim land as you walk around - default: true - factions.command.balance: + factions.balance: description: show current faction balance - default: true - factions.command.balance.any: + factions.balance.any: description: show on other factions balance - default: true - factions.command.withdraw: + factions.withdraw: description: withdraw money from your faction bank - default: true - factions.command.pay: + factions.pay: description: pay another faction from your bank - default: true - factions.command.bypass: + factions.bypass: description: enable admin bypass mode - default: op - factions.command.chat: + factions.chat: description: change chat mode - default: true - factions.command.claim: + factions.claim: description: claim the land where you are standing - default: true - factions.command.config: + factions.config: description: change a conf.json setting - default: op factions.create: description: create a new faction - default: true - factions.command.deinvite: + factions.deinvite: description: remove a pending invitation - default: true - factions.command.deposit: + factions.deposit: description: deposit money into your faction bank - default: true - factions.command.description: + factions.description: description: change the faction description - default: true - factions.command.disband: + factions.disband: description: disband a faction - default: true - factions.command.disband.any: + factions.disband.any: description: disband an other faction - default: op - factions.command.help: + factions.help: description: display a help page - default: true - factions.command.home: + factions.home: description: teleport to the faction home - default: true - factions.command.join: + factions.join: description: join a faction - default: true - factions.command.kick: + factions.kick: description: kick a player from the faction - default: true - factions.command.kick.any: + factions.kick.any: description: kick anyone from any faction - default: op - factions.command.leave: + factions.leave: description: leave your faction - default: true - factions.command.list: + factions.list: description: see a list of the factions - default: true - factions.command.lock: + factions.lock: description: lock all write stuff - default: op - factions.command.map: + factions.managesafezone: + description: claim land as a safe zone and build/destroy within safe zones + factions.managewarzone: + description: claim land as a war zone and build/destroy within war zones + factions.map: description: show territory map, set optional auto update - default: true - factions.command.mod: + factions.mod: description: give or revoke moderator rights - default: true - factions.command.noboom: + factions.noboom: description: toggle explosions (peaceful factions only) - default: true - factions.command.open: + factions.open: description: switch if invitation is required to join - default: true - factions.command.owner: + factions.owner: description: set ownership of claimed land - default: true - factions.command.ownerlist: + factions.ownerlist: description: list owner(s) of this claimed land - default: true - factions.command.setpeaceful: + factions.ownershipbypass: + description: bypass ownership restrictions within own faction's territory + factions.setpeaceful: description: designate a faction as peaceful - default: op - factions.command.setpermanent: + factions.setpermanent: description: designate a faction as permanent - default: op - factions.command.power: + factions.power: description: show player power info - default: true - factions.command.power.any: + factions.power.any: description: view an other players power level - default: true - factions.command.relation: + factions.relation: description: set relation wish to another faction - default: true - factions.command.reload: + factions.reload: description: reload data file(s) from disk - default: op - factions.command.save: + factions.save: description: save all data to disk - default: op - factions.command.sethome: + factions.sethome: description: set the faction home - default: true - factions.command.sethome.any: + factions.sethome.any: description: set any faction home - default: op - factions.command.show: - description: chow faction information - default: true - factions.command.tag: + factions.show: + description: show faction information + factions.tag: description: change the faction tag - default: true - factions.command.title: + factions.title: description: set or remove a players title - default: true - factions.command.version: + factions.version: description: see the version of the plugin - default: true - factions.command.unclaim: + factions.unclaim: description: unclaim the land where you are standing - default: true - factions.command.unclaimall: - description: unclaim all of your factions land - default: true \ No newline at end of file + factions.unclaimall: + description: unclaim all of your factions land \ No newline at end of file diff --git a/src/com/massivecraft/factions/P.java b/src/com/massivecraft/factions/P.java index deddf54f..c0d32310 100644 --- a/src/com/massivecraft/factions/P.java +++ b/src/com/massivecraft/factions/P.java @@ -13,7 +13,7 @@ import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; -import com.massivecraft.factions.commands.*; +import com.massivecraft.factions.cmd.*; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.integration.Worldguard; @@ -40,6 +40,12 @@ public class P extends MPlugin public final FactionsEntityListener entityListener; public final FactionsBlockListener blockListener; + // Persistance related + private boolean locked = true; + public boolean getLocked() {return this.locked;} + public void setLocked(boolean val) {this.locked = val; this.setAutoSave(val);} + + // Commands public FCmdRoot cmdBase; public P() @@ -131,7 +137,7 @@ public class P extends MPlugin } @Override - public void postSaveTask() + public void postAutoSave() { Board.save(); Conf.save(); diff --git a/src/com/massivecraft/factions/commands/CmdAdmin.java b/src/com/massivecraft/factions/cmd/CmdAdmin.java similarity index 89% rename from src/com/massivecraft/factions/commands/CmdAdmin.java rename to src/com/massivecraft/factions/cmd/CmdAdmin.java index 340a628e..e777ecb8 100644 --- a/src/com/massivecraft/factions/commands/CmdAdmin.java +++ b/src/com/massivecraft/factions/cmd/CmdAdmin.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; @@ -15,7 +15,8 @@ public class CmdAdmin extends FCommand this.requiredArgs.add("player name"); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_ADMIN.node; + this.permission = Permission.ADMIN.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -26,12 +27,6 @@ public class CmdAdmin extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - FPlayer fyou = this.argAsBestFPlayerMatch(0); if (fyou == null) return; diff --git a/src/com/massivecraft/factions/commands/CmdAutoClaim.java b/src/com/massivecraft/factions/cmd/CmdAutoClaim.java similarity index 88% rename from src/com/massivecraft/factions/commands/CmdAutoClaim.java rename to src/com/massivecraft/factions/cmd/CmdAutoClaim.java index cbb504f2..209939ae 100644 --- a/src/com/massivecraft/factions/commands/CmdAutoClaim.java +++ b/src/com/massivecraft/factions/cmd/CmdAutoClaim.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FLocation; @@ -14,7 +14,8 @@ public class CmdAutoClaim extends FCommand //this.requiredArgs.add(""); this.optionalArgs.put("on/off", "flipp"); - this.permission = Permission.COMMAND_AUTOCLAIM.node; + this.permission = Permission.AUTOCLAIM.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -25,12 +26,6 @@ public class CmdAutoClaim extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - boolean enabled = this.argAsBool(0, ! fme.isAutoClaimEnabled()); fme.setIsAutoClaimEnabled(enabled); diff --git a/src/com/massivecraft/factions/commands/CmdAutoSafeclaim.java b/src/com/massivecraft/factions/cmd/CmdAutoSafeclaim.java similarity index 91% rename from src/com/massivecraft/factions/commands/CmdAutoSafeclaim.java rename to src/com/massivecraft/factions/cmd/CmdAutoSafeclaim.java index dfc05ae0..2e519577 100644 --- a/src/com/massivecraft/factions/commands/CmdAutoSafeclaim.java +++ b/src/com/massivecraft/factions/cmd/CmdAutoSafeclaim.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.FLocation; @@ -17,6 +17,7 @@ public class CmdAutoSafeclaim extends FCommand this.optionalArgs.put("on/off", "flipp"); this.permission = Permission.MANAGE_SAFE_ZONE.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -29,12 +30,6 @@ public class CmdAutoSafeclaim extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - boolean enabled = this.argAsBool(0, ! fme.isAutoSafeClaimEnabled()); fme.setIsAutoSafeClaimEnabled(enabled); diff --git a/src/com/massivecraft/factions/commands/CmdAutoWarclaim.java b/src/com/massivecraft/factions/cmd/CmdAutoWarclaim.java similarity index 89% rename from src/com/massivecraft/factions/commands/CmdAutoWarclaim.java rename to src/com/massivecraft/factions/cmd/CmdAutoWarclaim.java index ff59d5f0..5c5cb1fc 100644 --- a/src/com/massivecraft/factions/commands/CmdAutoWarclaim.java +++ b/src/com/massivecraft/factions/cmd/CmdAutoWarclaim.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; @@ -18,6 +18,7 @@ public class CmdAutoWarclaim extends FCommand this.optionalArgs.put("on/off", "flipp"); this.permission = Permission.MANAGE_WAR_ZONE.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -30,14 +31,8 @@ public class CmdAutoWarclaim extends FCommand } @Override - public void perform() { - - if ( isLocked() ) - { - sendLockMessage(); - return; - } - + public void perform() + { boolean enabled = this.argAsBool(0, ! fme.isAutoWarClaimEnabled()); fme.setIsAutoWarClaimEnabled(enabled); diff --git a/src/com/massivecraft/factions/commands/CmdBalance.java b/src/com/massivecraft/factions/cmd/CmdBalance.java similarity index 85% rename from src/com/massivecraft/factions/commands/CmdBalance.java rename to src/com/massivecraft/factions/cmd/CmdBalance.java index e96d1246..b1208c68 100644 --- a/src/com/massivecraft/factions/commands/CmdBalance.java +++ b/src/com/massivecraft/factions/cmd/CmdBalance.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.integration.Econ; @@ -16,7 +16,8 @@ public class CmdBalance extends FCommand //this.requiredArgs.add("player name"); this.optionalArgs.put("factiontag", "yours"); - this.permission = Permission.COMMAND_BALANCE.node; + this.permission = Permission.BALANCE.node; + this.disableOnLock = false; senderMustBePlayer = true; senderMustBeMember = true; @@ -35,7 +36,7 @@ public class CmdBalance extends FCommand Faction faction = this.argAsFaction(0, myFaction); // TODO MAKE HIERARCHIAL COMMAND STRUCTURE HERE - if ( faction != myFaction && ! Permission.COMMAND_BALANCE_ANY.has(sender)) + if ( faction != myFaction && ! Permission.BALANCE_ANY.has(sender)) { sendMessageParsed("You do not have sufficient permissions to view the bank balance of other factions."); return; diff --git a/src/com/massivecraft/factions/commands/CmdBoom.java b/src/com/massivecraft/factions/cmd/CmdBoom.java similarity index 87% rename from src/com/massivecraft/factions/commands/CmdBoom.java rename to src/com/massivecraft/factions/cmd/CmdBoom.java index 9f1e583a..13ec5dec 100644 --- a/src/com/massivecraft/factions/commands/CmdBoom.java +++ b/src/com/massivecraft/factions/cmd/CmdBoom.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.struct.Permission; @@ -13,7 +13,8 @@ public class CmdBoom extends FCommand //this.requiredArgs.add(""); this.optionalArgs.put("on/off", "flipp"); - this.permission = Permission.COMMAND_NO_BOOM.node; + this.permission = Permission.NO_BOOM.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -24,12 +25,6 @@ public class CmdBoom extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - if ( ! myFaction.isPeaceful()) { fme.sendMessageParsed("This command is only usable by factions which are specially designated as peaceful."); diff --git a/src/com/massivecraft/factions/commands/CmdBypass.java b/src/com/massivecraft/factions/cmd/CmdBypass.java similarity index 89% rename from src/com/massivecraft/factions/commands/CmdBypass.java rename to src/com/massivecraft/factions/cmd/CmdBypass.java index c243eba2..c24523a5 100644 --- a/src/com/massivecraft/factions/commands/CmdBypass.java +++ b/src/com/massivecraft/factions/cmd/CmdBypass.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; @@ -13,7 +13,8 @@ public class CmdBypass extends FCommand //this.requiredArgs.add(""); this.optionalArgs.put("on/off", "flipp"); - this.permission = Permission.COMMAND_BYPASS.node; + this.permission = Permission.BYPASS.node; + this.disableOnLock = false; senderMustBePlayer = true; senderMustBeMember = false; diff --git a/src/com/massivecraft/factions/commands/CmdChat.java b/src/com/massivecraft/factions/cmd/CmdChat.java similarity index 92% rename from src/com/massivecraft/factions/commands/CmdChat.java rename to src/com/massivecraft/factions/cmd/CmdChat.java index b942defe..51cf7c32 100644 --- a/src/com/massivecraft/factions/commands/CmdChat.java +++ b/src/com/massivecraft/factions/cmd/CmdChat.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.struct.ChatMode; @@ -16,7 +16,8 @@ public class CmdChat extends FCommand //this.requiredArgs.add(""); this.optionalArgs.put("mode", "next"); - this.permission = Permission.COMMAND_CHAT.node; + this.permission = Permission.CHAT.node; + this.disableOnLock = false; senderMustBePlayer = true; senderMustBeMember = true; diff --git a/src/com/massivecraft/factions/commands/CmdClaim.java b/src/com/massivecraft/factions/cmd/CmdClaim.java similarity index 74% rename from src/com/massivecraft/factions/commands/CmdClaim.java rename to src/com/massivecraft/factions/cmd/CmdClaim.java index dcf462d1..aa6605ca 100644 --- a/src/com/massivecraft/factions/commands/CmdClaim.java +++ b/src/com/massivecraft/factions/cmd/CmdClaim.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.struct.Permission; @@ -13,7 +13,8 @@ public class CmdClaim extends FCommand //this.requiredArgs.add(""); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_CLAIM.node; + this.permission = Permission.CLAIM.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = true; @@ -26,12 +27,6 @@ public class CmdClaim extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - fme.attemptClaim(true); } diff --git a/src/com/massivecraft/factions/commands/CmdConfig.java b/src/com/massivecraft/factions/cmd/CmdConfig.java similarity index 97% rename from src/com/massivecraft/factions/commands/CmdConfig.java rename to src/com/massivecraft/factions/cmd/CmdConfig.java index 31b0994b..dcd3d58c 100644 --- a/src/com/massivecraft/factions/commands/CmdConfig.java +++ b/src/com/massivecraft/factions/cmd/CmdConfig.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; @@ -29,7 +29,8 @@ public class CmdConfig extends FCommand this.requiredArgs.add(""); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_CONFIG.node; + this.permission = Permission.CONFIG.node; + this.disableOnLock = true; senderMustBePlayer = false; senderMustBeMember = false; @@ -40,12 +41,6 @@ public class CmdConfig extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - // store a lookup map of lowercase field names paired with proper capitalization field names // that way, if the person using this command messes up the capitalization, we can fix that if (properFieldNames.isEmpty()) diff --git a/src/com/massivecraft/factions/commands/CmdCreate.java b/src/com/massivecraft/factions/cmd/CmdCreate.java similarity index 91% rename from src/com/massivecraft/factions/commands/CmdCreate.java rename to src/com/massivecraft/factions/cmd/CmdCreate.java index 6bc82cb8..cb6aa04e 100644 --- a/src/com/massivecraft/factions/commands/CmdCreate.java +++ b/src/com/massivecraft/factions/cmd/CmdCreate.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import java.util.ArrayList; @@ -21,7 +21,8 @@ public class CmdCreate extends FCommand this.requiredArgs.add("faction tag"); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_CREATE.node; + this.permission = Permission.CREATE.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -32,12 +33,6 @@ public class CmdCreate extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - String tag = this.argAsString(0); if (fme.hasFaction()) diff --git a/src/com/massivecraft/factions/commands/CmdDeinvite.java b/src/com/massivecraft/factions/cmd/CmdDeinvite.java similarity index 87% rename from src/com/massivecraft/factions/commands/CmdDeinvite.java rename to src/com/massivecraft/factions/cmd/CmdDeinvite.java index 83d162ff..6c33009c 100644 --- a/src/com/massivecraft/factions/commands/CmdDeinvite.java +++ b/src/com/massivecraft/factions/cmd/CmdDeinvite.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.struct.Permission; @@ -15,7 +15,8 @@ public class CmdDeinvite extends FCommand this.requiredArgs.add("player name"); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_DEINVITE.node; + this.permission = Permission.DEINVITE.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -26,12 +27,6 @@ public class CmdDeinvite extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - FPlayer you = this.argAsBestFPlayerMatch(0); if (you == null) return; diff --git a/src/com/massivecraft/factions/commands/CmdDeposit.java b/src/com/massivecraft/factions/cmd/CmdDeposit.java similarity index 93% rename from src/com/massivecraft/factions/commands/CmdDeposit.java rename to src/com/massivecraft/factions/cmd/CmdDeposit.java index 827fe955..3812c93e 100644 --- a/src/com/massivecraft/factions/commands/CmdDeposit.java +++ b/src/com/massivecraft/factions/cmd/CmdDeposit.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.integration.Econ; @@ -20,7 +20,8 @@ public class CmdDeposit extends FCommand this.requiredArgs.add("amount"); //this.optionalArgs - this.permission = Permission.COMMAND_DEPOSIT.node; + this.permission = Permission.DEPOSIT.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = true; diff --git a/src/com/massivecraft/factions/commands/CmdDescription.java b/src/com/massivecraft/factions/cmd/CmdDescription.java similarity index 87% rename from src/com/massivecraft/factions/commands/CmdDescription.java rename to src/com/massivecraft/factions/cmd/CmdDescription.java index f720a48f..aa339328 100644 --- a/src/com/massivecraft/factions/commands/CmdDescription.java +++ b/src/com/massivecraft/factions/cmd/CmdDescription.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; @@ -16,7 +16,8 @@ public class CmdDescription extends FCommand this.requiredArgs.add("desc"); //this.optionalArgs - this.permission = Permission.COMMAND_DESCRIPTION.node; + this.permission = Permission.DESCRIPTION.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -27,12 +28,6 @@ public class CmdDescription extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay if ( ! payForCommand(Conf.econCostDesc)) { diff --git a/src/com/massivecraft/factions/commands/CmdDisband.java b/src/com/massivecraft/factions/cmd/CmdDisband.java similarity index 89% rename from src/com/massivecraft/factions/commands/CmdDisband.java rename to src/com/massivecraft/factions/cmd/CmdDisband.java index 2c4641a7..4cb9ca89 100644 --- a/src/com/massivecraft/factions/commands/CmdDisband.java +++ b/src/com/massivecraft/factions/cmd/CmdDisband.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.integration.Econ; @@ -21,7 +21,8 @@ public class CmdDisband extends FCommand //this.requiredArgs.add(""); this.optionalArgs.put("faction tag", "yours"); - this.permission = Permission.COMMAND_DISBAND.node; + this.permission = Permission.DISBAND.node; + this.disableOnLock = true; senderMustBePlayer = false; senderMustBeMember = false; @@ -44,7 +45,7 @@ public class CmdDisband extends FCommand } else { - if ( ! Permission.COMMAND_DISBAND_ANY.has(me, true)) + if ( ! Permission.DISBAND_ANY.has(me, true)) { return; } diff --git a/src/com/massivecraft/factions/commands/CmdHelp.java b/src/com/massivecraft/factions/cmd/CmdHelp.java similarity index 98% rename from src/com/massivecraft/factions/commands/CmdHelp.java rename to src/com/massivecraft/factions/cmd/CmdHelp.java index 99b4e0bd..496545aa 100644 --- a/src/com/massivecraft/factions/commands/CmdHelp.java +++ b/src/com/massivecraft/factions/cmd/CmdHelp.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import java.util.ArrayList; @@ -21,7 +21,8 @@ public class CmdHelp extends FCommand //this.requiredArgs.add(""); this.optionalArgs.put("page", "1"); - this.permission = Permission.COMMAND_HELP.node; + this.permission = Permission.HELP.node; + this.disableOnLock = false; senderMustBePlayer = false; senderMustBeMember = false; diff --git a/src/com/massivecraft/factions/commands/CmdHome.java b/src/com/massivecraft/factions/cmd/CmdHome.java similarity index 96% rename from src/com/massivecraft/factions/commands/CmdHome.java rename to src/com/massivecraft/factions/cmd/CmdHome.java index dbdef81f..fab194bb 100644 --- a/src/com/massivecraft/factions/commands/CmdHome.java +++ b/src/com/massivecraft/factions/cmd/CmdHome.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import org.bukkit.Location; import org.bukkit.World; @@ -25,7 +25,8 @@ public class CmdHome extends FCommand //this.requiredArgs.add(""); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_HOME.node; + this.permission = Permission.HOME.node; + this.disableOnLock = false; senderMustBePlayer = true; senderMustBeMember = true; diff --git a/src/com/massivecraft/factions/commands/CmdInvite.java b/src/com/massivecraft/factions/cmd/CmdInvite.java similarity index 88% rename from src/com/massivecraft/factions/commands/CmdInvite.java rename to src/com/massivecraft/factions/cmd/CmdInvite.java index 03b29f0e..e9b107de 100644 --- a/src/com/massivecraft/factions/commands/CmdInvite.java +++ b/src/com/massivecraft/factions/cmd/CmdInvite.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; @@ -15,7 +15,8 @@ public class CmdInvite extends FCommand this.requiredArgs.add("player name"); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_INVITE.node; + this.permission = Permission.INVITE.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -26,12 +27,6 @@ public class CmdInvite extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - FPlayer you = this.argAsBestFPlayerMatch(0); if (you == null) return; diff --git a/src/com/massivecraft/factions/commands/CmdJoin.java b/src/com/massivecraft/factions/cmd/CmdJoin.java similarity index 91% rename from src/com/massivecraft/factions/commands/CmdJoin.java rename to src/com/massivecraft/factions/cmd/CmdJoin.java index 9e4262de..c923fcb3 100644 --- a/src/com/massivecraft/factions/commands/CmdJoin.java +++ b/src/com/massivecraft/factions/cmd/CmdJoin.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.Faction; @@ -14,7 +14,8 @@ public class CmdJoin extends FCommand this.requiredArgs.add("faction name"); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_JOIN.node; + this.permission = Permission.JOIN.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -25,12 +26,6 @@ public class CmdJoin extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - Faction faction = this.argAsFaction(0); if (faction == null) return; diff --git a/src/com/massivecraft/factions/commands/CmdKick.java b/src/com/massivecraft/factions/cmd/CmdKick.java similarity index 92% rename from src/com/massivecraft/factions/commands/CmdKick.java rename to src/com/massivecraft/factions/cmd/CmdKick.java index 492ce23e..07b9e08e 100644 --- a/src/com/massivecraft/factions/commands/CmdKick.java +++ b/src/com/massivecraft/factions/cmd/CmdKick.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; @@ -17,7 +17,8 @@ public class CmdKick extends FCommand this.requiredArgs.add("player name"); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_KICK.node; + this.permission = Permission.KICK.node; + this.disableOnLock = false; senderMustBePlayer = true; senderMustBeMember = false; @@ -28,12 +29,6 @@ public class CmdKick extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - FPlayer you = this.argAsBestFPlayerMatch(0); if (you == null) return; @@ -47,7 +42,7 @@ public class CmdKick extends FCommand Faction yourFaction = you.getFaction(); // players with admin-level "disband" permission can bypass these requirements - if ( ! Permission.COMMAND_KICK_ANY.has(sender)) + if ( ! Permission.KICK_ANY.has(sender)) { if (yourFaction != myFaction) { diff --git a/src/com/massivecraft/factions/commands/CmdLeave.java b/src/com/massivecraft/factions/cmd/CmdLeave.java similarity index 72% rename from src/com/massivecraft/factions/commands/CmdLeave.java rename to src/com/massivecraft/factions/cmd/CmdLeave.java index 62a06020..7cb11c17 100644 --- a/src/com/massivecraft/factions/commands/CmdLeave.java +++ b/src/com/massivecraft/factions/cmd/CmdLeave.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.struct.Permission; @@ -12,7 +12,8 @@ public class CmdLeave extends FCommand { //this.requiredArgs.add(""); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_LEAVE.node; + this.permission = Permission.LEAVE.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = true; @@ -23,12 +24,6 @@ public class CmdLeave extends FCommand { @Override public void perform() { - if ( isLocked() ) - { - sendLockMessage(); - return; - } - fme.leave(true); } diff --git a/src/com/massivecraft/factions/commands/CmdList.java b/src/com/massivecraft/factions/cmd/CmdList.java similarity index 95% rename from src/com/massivecraft/factions/commands/CmdList.java rename to src/com/massivecraft/factions/cmd/CmdList.java index 2d01eac9..5f22201b 100644 --- a/src/com/massivecraft/factions/commands/CmdList.java +++ b/src/com/massivecraft/factions/cmd/CmdList.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import java.util.ArrayList; import java.util.Collections; @@ -22,7 +22,8 @@ public class CmdList extends FCommand //this.requiredArgs.add(""); this.optionalArgs.put("page", "1"); - this.permission = Permission.COMMAND_LIST.node; + this.permission = Permission.LIST.node; + this.disableOnLock = false; senderMustBePlayer = false; senderMustBeMember = false; diff --git a/src/com/massivecraft/factions/commands/CmdLock.java b/src/com/massivecraft/factions/cmd/CmdLock.java similarity index 76% rename from src/com/massivecraft/factions/commands/CmdLock.java rename to src/com/massivecraft/factions/cmd/CmdLock.java index 628b75ae..e16c76a8 100644 --- a/src/com/massivecraft/factions/commands/CmdLock.java +++ b/src/com/massivecraft/factions/cmd/CmdLock.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.struct.Permission; @@ -19,7 +19,8 @@ public class CmdLock extends FCommand { //this.requiredArgs.add(""); this.optionalArgs.put("on/off", "flipp"); - this.permission = Permission.COMMAND_LOCK.node; + this.permission = Permission.LOCK.node; + this.disableOnLock = false; senderMustBePlayer = false; senderMustBeMember = false; @@ -30,9 +31,9 @@ public class CmdLock extends FCommand { @Override public void perform() { - setIsLocked(this.argAsBool(0, ! isLocked())); + p.setLocked(this.argAsBool(0, ! p.getLocked())); - if( isLocked() ) + if( p.getLocked()) { sendMessageParsed("Factions is now locked"); } diff --git a/src/com/massivecraft/factions/commands/CmdMap.java b/src/com/massivecraft/factions/cmd/CmdMap.java similarity index 92% rename from src/com/massivecraft/factions/commands/CmdMap.java rename to src/com/massivecraft/factions/cmd/CmdMap.java index 6b0414f9..9a1f831b 100644 --- a/src/com/massivecraft/factions/commands/CmdMap.java +++ b/src/com/massivecraft/factions/cmd/CmdMap.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; @@ -16,7 +16,8 @@ public class CmdMap extends FCommand //this.requiredArgs.add(""); this.optionalArgs.put("on/off", "once"); - this.permission = Permission.COMMAND_MAP.node; + this.permission = Permission.MAP.node; + this.disableOnLock = false; senderMustBePlayer = true; senderMustBeMember = false; diff --git a/src/com/massivecraft/factions/commands/CmdMod.java b/src/com/massivecraft/factions/cmd/CmdMod.java similarity index 88% rename from src/com/massivecraft/factions/commands/CmdMod.java rename to src/com/massivecraft/factions/cmd/CmdMod.java index c92adffd..dc29e31c 100644 --- a/src/com/massivecraft/factions/commands/CmdMod.java +++ b/src/com/massivecraft/factions/cmd/CmdMod.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.struct.Permission; @@ -15,7 +15,8 @@ public class CmdMod extends FCommand this.requiredArgs.add("player name"); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_MOD.node; + this.permission = Permission.MOD.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -26,12 +27,6 @@ public class CmdMod extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - FPlayer you = this.argAsBestFPlayerMatch(0); if (you == null) return; diff --git a/src/com/massivecraft/factions/commands/CmdOpen.java b/src/com/massivecraft/factions/cmd/CmdOpen.java similarity index 87% rename from src/com/massivecraft/factions/commands/CmdOpen.java rename to src/com/massivecraft/factions/cmd/CmdOpen.java index 167ef173..a92ad3e4 100644 --- a/src/com/massivecraft/factions/commands/CmdOpen.java +++ b/src/com/massivecraft/factions/cmd/CmdOpen.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.Faction; @@ -15,7 +15,8 @@ public class CmdOpen extends FCommand //this.requiredArgs.add(""); this.optionalArgs.put("yes/no", "flipp"); - this.permission = Permission.COMMAND_OPEN.node; + this.permission = Permission.OPEN.node; + this.disableOnLock = false; senderMustBePlayer = true; senderMustBeMember = false; @@ -26,12 +27,6 @@ public class CmdOpen extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay if ( ! payForCommand(Conf.econCostOpen)) return; diff --git a/src/com/massivecraft/factions/commands/CmdOwner.java b/src/com/massivecraft/factions/cmd/CmdOwner.java similarity index 94% rename from src/com/massivecraft/factions/commands/CmdOwner.java rename to src/com/massivecraft/factions/cmd/CmdOwner.java index e5f1bc1c..74d2c0b6 100644 --- a/src/com/massivecraft/factions/commands/CmdOwner.java +++ b/src/com/massivecraft/factions/cmd/CmdOwner.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; @@ -20,7 +20,8 @@ public class CmdOwner extends FCommand //this.requiredArgs.add(""); this.optionalArgs.put("player name", "you"); - this.permission = Permission.COMMAND_OWNER.node; + this.permission = Permission.OWNER.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -33,12 +34,6 @@ public class CmdOwner extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - boolean hasBypass = fme.isAdminBypassing(); if ( ! hasBypass && ! assertHasFaction()) { diff --git a/src/com/massivecraft/factions/commands/CmdOwnerList.java b/src/com/massivecraft/factions/cmd/CmdOwnerList.java similarity index 92% rename from src/com/massivecraft/factions/commands/CmdOwnerList.java rename to src/com/massivecraft/factions/cmd/CmdOwnerList.java index ad72870e..d7b1f4e6 100644 --- a/src/com/massivecraft/factions/commands/CmdOwnerList.java +++ b/src/com/massivecraft/factions/cmd/CmdOwnerList.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; @@ -17,7 +17,8 @@ public class CmdOwnerList extends FCommand //this.requiredArgs.add(""); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_OWNERLIST.node; + this.permission = Permission.OWNERLIST.node; + this.disableOnLock = false; senderMustBePlayer = true; senderMustBeMember = false; diff --git a/src/com/massivecraft/factions/commands/CmdPay.java b/src/com/massivecraft/factions/cmd/CmdPay.java similarity index 93% rename from src/com/massivecraft/factions/commands/CmdPay.java rename to src/com/massivecraft/factions/cmd/CmdPay.java index 2e7913df..a5ece5fc 100644 --- a/src/com/massivecraft/factions/commands/CmdPay.java +++ b/src/com/massivecraft/factions/cmd/CmdPay.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.integration.Econ; @@ -20,7 +20,8 @@ public class CmdPay extends FCommand this.requiredArgs.add("amount"); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_PAY.node; + this.permission = Permission.PAY.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = true; @@ -29,7 +30,8 @@ public class CmdPay extends FCommand } @Override - public void perform() { + public void perform() + { if ( ! Conf.bankEnabled) return; if ( ! Conf.bankMembersCanWithdraw && ! assertMinRole(Role.MODERATOR)) diff --git a/src/com/massivecraft/factions/commands/CmdPeaceful.java b/src/com/massivecraft/factions/cmd/CmdPeaceful.java similarity index 88% rename from src/com/massivecraft/factions/commands/CmdPeaceful.java rename to src/com/massivecraft/factions/cmd/CmdPeaceful.java index 177176ec..a8a62321 100644 --- a/src/com/massivecraft/factions/commands/CmdPeaceful.java +++ b/src/com/massivecraft/factions/cmd/CmdPeaceful.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Faction; @@ -17,7 +17,8 @@ public class CmdPeaceful extends FCommand this.requiredArgs.add("faction tag"); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_SET_PEACEFUL.node; + this.permission = Permission.SET_PEACEFUL.node; + this.disableOnLock = true; senderMustBePlayer = false; senderMustBeMember = false; diff --git a/src/com/massivecraft/factions/commands/CmdPermanent.java b/src/com/massivecraft/factions/cmd/CmdPermanent.java similarity index 87% rename from src/com/massivecraft/factions/commands/CmdPermanent.java rename to src/com/massivecraft/factions/cmd/CmdPermanent.java index 419d0757..8cc40a0a 100644 --- a/src/com/massivecraft/factions/commands/CmdPermanent.java +++ b/src/com/massivecraft/factions/cmd/CmdPermanent.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Faction; @@ -16,7 +16,8 @@ public class CmdPermanent extends FCommand this.requiredArgs.add("faction tag"); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_SET_PERMANENT.node; + this.permission = Permission.SET_PERMANENT.node; + this.disableOnLock = true; senderMustBePlayer = false; senderMustBeMember = false; diff --git a/src/com/massivecraft/factions/commands/CmdPower.java b/src/com/massivecraft/factions/cmd/CmdPower.java similarity index 83% rename from src/com/massivecraft/factions/commands/CmdPower.java rename to src/com/massivecraft/factions/cmd/CmdPower.java index edaa049f..146b8830 100644 --- a/src/com/massivecraft/factions/commands/CmdPower.java +++ b/src/com/massivecraft/factions/cmd/CmdPower.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; @@ -16,7 +16,8 @@ public class CmdPower extends FCommand //this.requiredArgs.add("faction tag"); this.optionalArgs.put("player name", "you"); - this.permission = Permission.COMMAND_POWER.node; + this.permission = Permission.POWER.node; + this.disableOnLock = false; senderMustBePlayer = false; senderMustBeMember = false; @@ -30,7 +31,7 @@ public class CmdPower extends FCommand FPlayer target = this.argAsBestFPlayerMatch(0, fme); if (target == null) return; - if (target != me && ! Permission.COMMAND_POWER_ANY.has(sender, true)) return; + if (target != me && ! Permission.POWER_ANY.has(sender, true)) return; // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay if ( ! payForCommand(Conf.econCostPower)) return; diff --git a/src/com/massivecraft/factions/commands/CmdRelationAlly.java b/src/com/massivecraft/factions/cmd/CmdRelationAlly.java similarity index 81% rename from src/com/massivecraft/factions/commands/CmdRelationAlly.java rename to src/com/massivecraft/factions/cmd/CmdRelationAlly.java index 5cd67d8f..c8814fa8 100644 --- a/src/com/massivecraft/factions/commands/CmdRelationAlly.java +++ b/src/com/massivecraft/factions/cmd/CmdRelationAlly.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.struct.Relation; diff --git a/src/com/massivecraft/factions/commands/CmdRelationEnemy.java b/src/com/massivecraft/factions/cmd/CmdRelationEnemy.java similarity index 82% rename from src/com/massivecraft/factions/commands/CmdRelationEnemy.java rename to src/com/massivecraft/factions/cmd/CmdRelationEnemy.java index 0ba25de9..11882bf0 100644 --- a/src/com/massivecraft/factions/commands/CmdRelationEnemy.java +++ b/src/com/massivecraft/factions/cmd/CmdRelationEnemy.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.struct.Relation; diff --git a/src/com/massivecraft/factions/commands/CmdRelationNeutral.java b/src/com/massivecraft/factions/cmd/CmdRelationNeutral.java similarity index 82% rename from src/com/massivecraft/factions/commands/CmdRelationNeutral.java rename to src/com/massivecraft/factions/cmd/CmdRelationNeutral.java index 173a0fca..03b40e19 100644 --- a/src/com/massivecraft/factions/commands/CmdRelationNeutral.java +++ b/src/com/massivecraft/factions/cmd/CmdRelationNeutral.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.struct.Relation; diff --git a/src/com/massivecraft/factions/commands/CmdReload.java b/src/com/massivecraft/factions/cmd/CmdReload.java similarity index 89% rename from src/com/massivecraft/factions/commands/CmdReload.java rename to src/com/massivecraft/factions/cmd/CmdReload.java index a2386837..d27d4f41 100644 --- a/src/com/massivecraft/factions/commands/CmdReload.java +++ b/src/com/massivecraft/factions/cmd/CmdReload.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; @@ -18,7 +18,8 @@ public class CmdReload extends FCommand //this.requiredArgs.add(""); this.optionalArgs.put("file", "all"); - this.permission = Permission.COMMAND_RELOAD.node; + this.permission = Permission.RELOAD.node; + this.disableOnLock = false; senderMustBePlayer = false; senderMustBeMember = false; diff --git a/src/com/massivecraft/factions/commands/CmdSafeclaim.java b/src/com/massivecraft/factions/cmd/CmdSafeclaim.java similarity index 91% rename from src/com/massivecraft/factions/commands/CmdSafeclaim.java rename to src/com/massivecraft/factions/cmd/CmdSafeclaim.java index ca501f5c..6854150c 100644 --- a/src/com/massivecraft/factions/commands/CmdSafeclaim.java +++ b/src/com/massivecraft/factions/cmd/CmdSafeclaim.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.FLocation; @@ -17,6 +17,7 @@ public class CmdSafeclaim extends FCommand this.optionalArgs.put("radius", "0"); this.permission = Permission.MANAGE_SAFE_ZONE.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -29,12 +30,6 @@ public class CmdSafeclaim extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - // The current location of the player FLocation playerFlocation = new FLocation(fme); diff --git a/src/com/massivecraft/factions/commands/CmdSafeunclaimall.java b/src/com/massivecraft/factions/cmd/CmdSafeunclaimall.java similarity index 87% rename from src/com/massivecraft/factions/commands/CmdSafeunclaimall.java rename to src/com/massivecraft/factions/cmd/CmdSafeunclaimall.java index 4deee78e..a01ad132 100644 --- a/src/com/massivecraft/factions/commands/CmdSafeunclaimall.java +++ b/src/com/massivecraft/factions/cmd/CmdSafeunclaimall.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.Factions; @@ -16,6 +16,7 @@ public class CmdSafeunclaimall extends FCommand this.optionalArgs.put("radius", "0"); this.permission = Permission.MANAGE_SAFE_ZONE.node; + this.disableOnLock = true; senderMustBePlayer = false; senderMustBeMember = false; @@ -28,12 +29,6 @@ public class CmdSafeunclaimall extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - Board.unclaimAll(Factions.i.getSafeZone().getId()); sendMessageParsed("You unclaimed ALL safe zone land."); } diff --git a/src/com/massivecraft/factions/commands/CmdSaveAll.java b/src/com/massivecraft/factions/cmd/CmdSaveAll.java similarity index 83% rename from src/com/massivecraft/factions/commands/CmdSaveAll.java rename to src/com/massivecraft/factions/cmd/CmdSaveAll.java index 44f156cd..dd653b43 100644 --- a/src/com/massivecraft/factions/commands/CmdSaveAll.java +++ b/src/com/massivecraft/factions/cmd/CmdSaveAll.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; @@ -18,7 +18,8 @@ public class CmdSaveAll extends FCommand //this.requiredArgs.add(""); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_SAVE.node; + this.permission = Permission.SAVE.node; + this.disableOnLock = false; senderMustBePlayer = false; senderMustBeMember = false; diff --git a/src/com/massivecraft/factions/commands/CmdSethome.java b/src/com/massivecraft/factions/cmd/CmdSethome.java similarity index 82% rename from src/com/massivecraft/factions/commands/CmdSethome.java rename to src/com/massivecraft/factions/cmd/CmdSethome.java index 3332f993..afb54724 100644 --- a/src/com/massivecraft/factions/commands/CmdSethome.java +++ b/src/com/massivecraft/factions/cmd/CmdSethome.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; @@ -16,7 +16,8 @@ public class CmdSethome extends FCommand //this.requiredArgs.add(""); this.optionalArgs.put("faction tag", "mine"); - this.permission = Permission.COMMAND_SETHOME.node; + this.permission = Permission.SETHOME.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -27,12 +28,6 @@ public class CmdSethome extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - if ( ! Conf.homesEnabled) { fme.sendMessageParsed("Sorry, Faction homes are disabled on this server."); @@ -45,17 +40,17 @@ public class CmdSethome extends FCommand // Can the player set the home for this faction? if (faction == myFaction) { - if ( ! Permission.COMMAND_SETHOME_ANY.has(sender) && ! assertMinRole(Role.MODERATOR)) return; + if ( ! Permission.SETHOME_ANY.has(sender) && ! assertMinRole(Role.MODERATOR)) return; } else { - if (Permission.COMMAND_SETHOME_ANY.has(sender, true)) return; + if (Permission.SETHOME_ANY.has(sender, true)) return; } // Can the player set the faction home HERE? if ( - ! Permission.COMMAND_BYPASS.has(me) + ! Permission.BYPASS.has(me) && Conf.homesMustBeInClaimedTerritory && diff --git a/src/com/massivecraft/factions/commands/CmdShow.java b/src/com/massivecraft/factions/cmd/CmdShow.java similarity index 97% rename from src/com/massivecraft/factions/commands/CmdShow.java rename to src/com/massivecraft/factions/cmd/CmdShow.java index dc2dbe25..85150426 100644 --- a/src/com/massivecraft/factions/commands/CmdShow.java +++ b/src/com/massivecraft/factions/cmd/CmdShow.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import java.util.Collection; @@ -21,7 +21,8 @@ public class CmdShow extends FCommand //this.requiredArgs.add(""); this.optionalArgs.put("faction tag", "yours"); - this.permission = Permission.COMMAND_SHOW.node; + this.permission = Permission.SHOW.node; + this.disableOnLock = false; senderMustBePlayer = true; senderMustBeMember = false; diff --git a/src/com/massivecraft/factions/commands/CmdTag.java b/src/com/massivecraft/factions/cmd/CmdTag.java similarity index 92% rename from src/com/massivecraft/factions/commands/CmdTag.java rename to src/com/massivecraft/factions/cmd/CmdTag.java index 7d8d02bb..f1b8e630 100644 --- a/src/com/massivecraft/factions/commands/CmdTag.java +++ b/src/com/massivecraft/factions/cmd/CmdTag.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import java.util.ArrayList; @@ -19,7 +19,8 @@ public class CmdTag extends FCommand this.requiredArgs.add("faction tag"); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_TAG.node; + this.permission = Permission.TAG.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -30,12 +31,6 @@ public class CmdTag extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - String tag = this.argAsString(0); // TODO does not first test cover selfcase? diff --git a/src/com/massivecraft/factions/commands/CmdTitle.java b/src/com/massivecraft/factions/cmd/CmdTitle.java similarity index 88% rename from src/com/massivecraft/factions/commands/CmdTitle.java rename to src/com/massivecraft/factions/cmd/CmdTitle.java index 0df981a2..4974c8b6 100644 --- a/src/com/massivecraft/factions/commands/CmdTitle.java +++ b/src/com/massivecraft/factions/cmd/CmdTitle.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; @@ -15,7 +15,8 @@ public class CmdTitle extends FCommand this.requiredArgs.add("player name"); this.optionalArgs.put("title", ""); - this.permission = Permission.COMMAND_TITLE.node; + this.permission = Permission.TITLE.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -26,12 +27,6 @@ public class CmdTitle extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - FPlayer you = this.argAsBestFPlayerMatch(0); if (you == null) return; diff --git a/src/com/massivecraft/factions/commands/CmdUnclaim.java b/src/com/massivecraft/factions/cmd/CmdUnclaim.java similarity index 95% rename from src/com/massivecraft/factions/commands/CmdUnclaim.java rename to src/com/massivecraft/factions/cmd/CmdUnclaim.java index 46cdb5a6..72ab2173 100644 --- a/src/com/massivecraft/factions/commands/CmdUnclaim.java +++ b/src/com/massivecraft/factions/cmd/CmdUnclaim.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; @@ -18,7 +18,8 @@ public class CmdUnclaim extends FCommand //this.requiredArgs.add(""); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_UNCLAIM.node; + this.permission = Permission.UNCLAIM.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -29,12 +30,6 @@ public class CmdUnclaim extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - FLocation flocation = new FLocation(fme); Faction otherFaction = Board.getFactionAt(flocation); diff --git a/src/com/massivecraft/factions/commands/CmdUnclaimall.java b/src/com/massivecraft/factions/cmd/CmdUnclaimall.java similarity index 93% rename from src/com/massivecraft/factions/commands/CmdUnclaimall.java rename to src/com/massivecraft/factions/cmd/CmdUnclaimall.java index 60794706..dee26730 100644 --- a/src/com/massivecraft/factions/commands/CmdUnclaimall.java +++ b/src/com/massivecraft/factions/cmd/CmdUnclaimall.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; @@ -16,7 +16,8 @@ public class CmdUnclaimall extends FCommand //this.requiredArgs.add(""); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_UNCLAIM_ALL.node; + this.permission = Permission.UNCLAIM_ALL.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -27,12 +28,6 @@ public class CmdUnclaimall extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - String moneyBack = ""; if (Econ.enabled()) { diff --git a/src/com/massivecraft/factions/commands/CmdVersion.java b/src/com/massivecraft/factions/cmd/CmdVersion.java similarity index 81% rename from src/com/massivecraft/factions/commands/CmdVersion.java rename to src/com/massivecraft/factions/cmd/CmdVersion.java index e995cb01..0517ab05 100644 --- a/src/com/massivecraft/factions/commands/CmdVersion.java +++ b/src/com/massivecraft/factions/cmd/CmdVersion.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; @@ -13,7 +13,8 @@ public class CmdVersion extends FCommand //this.requiredArgs.add(""); //this.optionalArgs.put("", ""); - this.permission = Permission.COMMAND_VERSION.node; + this.permission = Permission.VERSION.node; + this.disableOnLock = false; senderMustBePlayer = false; senderMustBeMember = false; diff --git a/src/com/massivecraft/factions/commands/CmdWarclaim.java b/src/com/massivecraft/factions/cmd/CmdWarclaim.java similarity index 91% rename from src/com/massivecraft/factions/commands/CmdWarclaim.java rename to src/com/massivecraft/factions/cmd/CmdWarclaim.java index cd54feb9..b512ac38 100644 --- a/src/com/massivecraft/factions/commands/CmdWarclaim.java +++ b/src/com/massivecraft/factions/cmd/CmdWarclaim.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.FLocation; @@ -17,6 +17,7 @@ public class CmdWarclaim extends FCommand this.optionalArgs.put("radius", "0"); this.permission = Permission.MANAGE_WAR_ZONE.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -28,12 +29,6 @@ public class CmdWarclaim extends FCommand public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - // The current location of the player FLocation playerFlocation = new FLocation(fme); diff --git a/src/com/massivecraft/factions/commands/CmdWarunclaimall.java b/src/com/massivecraft/factions/cmd/CmdWarunclaimall.java similarity index 87% rename from src/com/massivecraft/factions/commands/CmdWarunclaimall.java rename to src/com/massivecraft/factions/cmd/CmdWarunclaimall.java index 08895d83..5117a5d9 100644 --- a/src/com/massivecraft/factions/commands/CmdWarunclaimall.java +++ b/src/com/massivecraft/factions/cmd/CmdWarunclaimall.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.Factions; @@ -16,6 +16,7 @@ public class CmdWarunclaimall extends FCommand //this.optionalArgs.put("", ""); this.permission = Permission.MANAGE_WAR_ZONE.node; + this.disableOnLock = true; senderMustBePlayer = false; senderMustBeMember = false; @@ -28,13 +29,6 @@ public class CmdWarunclaimall extends FCommand @Override public void perform() { - - if( isLocked() ) - { - sendLockMessage(); - return; - } - Board.unclaimAll(Factions.i.getWarZone().getId()); sendMessageParsed("You unclaimed ALL war zone land."); } diff --git a/src/com/massivecraft/factions/commands/CmdWithdraw.java b/src/com/massivecraft/factions/cmd/CmdWithdraw.java similarity index 94% rename from src/com/massivecraft/factions/commands/CmdWithdraw.java rename to src/com/massivecraft/factions/cmd/CmdWithdraw.java index ed0900ef..b8a184d3 100644 --- a/src/com/massivecraft/factions/commands/CmdWithdraw.java +++ b/src/com/massivecraft/factions/cmd/CmdWithdraw.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.integration.Econ; @@ -20,7 +20,8 @@ public class CmdWithdraw extends FCommand this.requiredArgs.add("amount"); //this.optionalArgs.put("factiontag", "yours"); - this.permission = Permission.COMMAND_WITHDRAW.node; + this.permission = Permission.WITHDRAW.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = true; diff --git a/src/com/massivecraft/factions/commands/FCmdRoot.java b/src/com/massivecraft/factions/cmd/FCmdRoot.java similarity index 96% rename from src/com/massivecraft/factions/commands/FCmdRoot.java rename to src/com/massivecraft/factions/cmd/FCmdRoot.java index 973b510e..ce79feab 100644 --- a/src/com/massivecraft/factions/commands/FCmdRoot.java +++ b/src/com/massivecraft/factions/cmd/FCmdRoot.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; @@ -65,6 +65,8 @@ public class FCmdRoot extends FCommand senderMustBeModerator = false; senderMustBeAdmin = false; + this.disableOnLock = false; + this.setHelpShort("The faction base command"); this.helpLong.add(p.txt.tags("This command contains all faction stuff.")); diff --git a/src/com/massivecraft/factions/commands/FCommand.java b/src/com/massivecraft/factions/cmd/FCommand.java similarity index 94% rename from src/com/massivecraft/factions/commands/FCommand.java rename to src/com/massivecraft/factions/cmd/FCommand.java index 68e37a89..053cf13f 100644 --- a/src/com/massivecraft/factions/commands/FCommand.java +++ b/src/com/massivecraft/factions/cmd/FCommand.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import java.util.List; @@ -18,17 +18,7 @@ import com.massivecraft.factions.zcore.MCommand; public abstract class FCommand extends MCommand

{ - //TODO: Legacy to handle - private static boolean lock = false; - // TODO: Move these messages to the locked command?? - // TODO: I lost the check for this code somewhere as well :/ - public void setIsLocked(boolean isLocked) { lock = isLocked; } - public boolean isLocked() { return lock; } - public void sendLockMessage() - { - // TODO: CCOLOR!!! - me.sendMessage("Factions is locked. Please try again later"); - } + public boolean disableOnLock; public FPlayer fme; public Faction myFaction; @@ -39,6 +29,10 @@ public abstract class FCommand extends MCommand

public FCommand() { super(P.p); + + // Due to safety reasons it defaults to disable on lock. + disableOnLock = true; + senderMustBeMember = false; senderMustBeModerator = false; senderMustBeAdmin = false; @@ -60,6 +54,17 @@ public abstract class FCommand extends MCommand

super.execute(sender, args, commandChain); } + @Override + public boolean isEnabled() + { + if (p.getLocked() && this.disableOnLock) + { + sendMessageParsed("Factions was locked by an admin. Please try again later."); + return false; + } + return true; + } + @Override public boolean validSenderType(CommandSender sender, boolean informSenderIfNot) { diff --git a/src/com/massivecraft/factions/commands/FRelationCommand.java b/src/com/massivecraft/factions/cmd/FRelationCommand.java similarity index 94% rename from src/com/massivecraft/factions/commands/FRelationCommand.java rename to src/com/massivecraft/factions/cmd/FRelationCommand.java index a1762fae..eb4e0ee4 100644 --- a/src/com/massivecraft/factions/commands/FRelationCommand.java +++ b/src/com/massivecraft/factions/cmd/FRelationCommand.java @@ -1,4 +1,4 @@ -package com.massivecraft.factions.commands; +package com.massivecraft.factions.cmd; import org.bukkit.ChatColor; @@ -18,7 +18,8 @@ public abstract class FRelationCommand extends FCommand this.requiredArgs.add("faction tag"); //this.optionalArgs.put("player name", "you"); - this.permission = Permission.COMMAND_RELATION.node; + this.permission = Permission.RELATION.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; @@ -29,12 +30,6 @@ public abstract class FRelationCommand extends FCommand @Override public void perform() { - if( isLocked() ) - { - sendLockMessage(); - return; - } - Faction them = this.argAsFaction(0); if ( ! them.isNormal()) diff --git a/src/com/massivecraft/factions/integration/Econ.java b/src/com/massivecraft/factions/integration/Econ.java index 7004d433..6c0f6117 100644 --- a/src/com/massivecraft/factions/integration/Econ.java +++ b/src/com/massivecraft/factions/integration/Econ.java @@ -4,7 +4,7 @@ import org.bukkit.event.Event; import org.bukkit.plugin.Plugin; import com.massivecraft.factions.listeners.FactionsServerListener; -import com.massivecraft.factions.commands.CmdHelp; +import com.massivecraft.factions.cmd.CmdHelp; import com.earth2me.essentials.api.Economy; import com.nijikokun.register.payment.Methods; diff --git a/src/com/massivecraft/factions/struct/Permission.java b/src/com/massivecraft/factions/struct/Permission.java index dafb6fc2..8bdadc36 100644 --- a/src/com/massivecraft/factions/struct/Permission.java +++ b/src/com/massivecraft/factions/struct/Permission.java @@ -9,52 +9,52 @@ public enum Permission MANAGE_SAFE_ZONE("managesafezone"), MANAGE_WAR_ZONE("managewarzone"), OWNERSHIP_BYPASS("ownershipbypass"), - COMMAND_ADMIN("command.admin"), - COMMAND_AUTOCLAIM("command.autoclaim"), - COMMAND_BALANCE("command.balance"), - COMMAND_BALANCE_ANY("command.balance.any"), - COMMAND_WITHDRAW("command.withdraw"), - COMMAND_PAY("command.pay"), - COMMAND_BYPASS("command.bypass"), - COMMAND_CHAT("command.chat"), - COMMAND_CLAIM("command.claim"), - COMMAND_CONFIG("command.config"), - COMMAND_CREATE("command.create"), - COMMAND_DEINVITE("command.deinvite"), - COMMAND_DEPOSIT("command.deposit"), - COMMAND_DESCRIPTION("command.description"), - COMMAND_DISBAND("command.disband"), - COMMAND_DISBAND_ANY("command.disband.any"), - COMMAND_HELP("command.help"), - COMMAND_HOME("command.home"), - COMMAND_INVITE("command.invite"), - COMMAND_JOIN("command.join"), - COMMAND_KICK("command.kick"), - COMMAND_KICK_ANY("command.kick.any"), - COMMAND_LEAVE("command.leave"), - COMMAND_LIST("command.list"), - COMMAND_LOCK("command.lock"), - COMMAND_MAP("command.map"), - COMMAND_MOD("command.mod"), - COMMAND_NO_BOOM("command.noboom"), - COMMAND_OPEN("command.open"), - COMMAND_OWNER("command.owner"), - COMMAND_OWNERLIST("command.ownerlist"), - COMMAND_SET_PEACEFUL("command.setpeaceful"), - COMMAND_SET_PERMANENT("command.setpermanent"), - COMMAND_POWER("command.power"), - COMMAND_POWER_ANY("command.power.any"), - COMMAND_RELATION("command.relation"), - COMMAND_RELOAD("command.reload"), - COMMAND_SAVE("command.save"), - COMMAND_SETHOME("command.sethome"), - COMMAND_SETHOME_ANY("command.sethome.any"), - COMMAND_SHOW("command.show"), - COMMAND_TAG("command.tag"), - COMMAND_TITLE("command.title"), - COMMAND_UNCLAIM("command.unclaim"), - COMMAND_UNCLAIM_ALL("command.unclaimall"), - COMMAND_VERSION("command.version"), + ADMIN("admin"), + AUTOCLAIM("autoclaim"), + BALANCE("balance"), + BALANCE_ANY("balance.any"), + WITHDRAW("withdraw"), + PAY("pay"), + BYPASS("bypass"), + CHAT("chat"), + CLAIM("claim"), + CONFIG("config"), + CREATE("create"), + DEINVITE("deinvite"), + DEPOSIT("deposit"), + DESCRIPTION("description"), + DISBAND("disband"), + DISBAND_ANY("disband.any"), + HELP("help"), + HOME("home"), + INVITE("invite"), + JOIN("join"), + KICK("kick"), + KICK_ANY("kick.any"), + LEAVE("leave"), + LIST("list"), + LOCK("lock"), + MAP("map"), + MOD("mod"), + NO_BOOM("noboom"), + OPEN("open"), + OWNER("owner"), + OWNERLIST("ownerlist"), + SET_PEACEFUL("setpeaceful"), + SET_PERMANENT("setpermanent"), + 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; @@ -73,27 +73,4 @@ public enum Permission { return has(sender, false); } - - /*public boolean has(CommandSender sender) - { - //return CreativeGates.p.perm.has(sender, this.node); - } - - public static boolean isCommandDisabled(CommandSender sender, String command) - { - return (hasPerm(sender, "factions.commandDisable."+command) && !hasPerm(sender, "factions.commandDisable.none")); - } - - private static boolean hasPerm(CommandSender sender, String permNode) - { - if (Factions.Permissions == null || ! (sender instanceof Player)) - { - return sender.isOp() || sender.hasPermission(permNode); - } - - Player player = (Player)sender; - return Factions.Permissions.has(player, permNode); - }*/ - - } diff --git a/src/com/massivecraft/factions/zcore/MCommand.java b/src/com/massivecraft/factions/zcore/MCommand.java index 269bf752..9e1280d2 100644 --- a/src/com/massivecraft/factions/zcore/MCommand.java +++ b/src/com/massivecraft/factions/zcore/MCommand.java @@ -112,10 +112,9 @@ public abstract class MCommand } } - if ( ! validCall(this.sender, this.args)) - { - return; - } + if ( ! validCall(this.sender, this.args)) return; + + if ( ! this.isEnabled()) return; perform(); } @@ -136,7 +135,6 @@ public abstract class MCommand /** * In this method we validate that all prerequisites to perform this command has been met. */ - // TODO: There should be a boolean for silence public boolean validCall(CommandSender sender, List args) { @@ -158,6 +156,11 @@ public abstract class MCommand return true; } + public boolean isEnabled() + { + return true; + } + public boolean validSenderType(CommandSender sender, boolean informSenderIfNot) { if (this.senderMustBePlayer && ! (sender instanceof Player)) diff --git a/src/com/massivecraft/factions/zcore/MPlugin.java b/src/com/massivecraft/factions/zcore/MPlugin.java index e88b62a6..6e688df2 100644 --- a/src/com/massivecraft/factions/zcore/MPlugin.java +++ b/src/com/massivecraft/factions/zcore/MPlugin.java @@ -34,6 +34,9 @@ public abstract class MPlugin extends JavaPlugin // Persist related public Gson gson; private Integer saveTask = null; + private boolean autoSave = true; + public boolean getAutoSave() {return this.autoSave;} + public void setAutoSave(boolean val) {this.autoSave = val;} // Listeners private MPluginSecretPlayerListener mPluginSecretPlayerListener; @@ -229,12 +232,12 @@ public abstract class MPlugin extends JavaPlugin // -------------------------------------------- // // HOOKS // -------------------------------------------- // - public void preSaveTask() + public void preAutoSave() { } - public void postSaveTask() + public void postAutoSave() { } diff --git a/src/com/massivecraft/factions/zcore/persist/SaveTask.java b/src/com/massivecraft/factions/zcore/persist/SaveTask.java index b78c27d0..3b03126d 100644 --- a/src/com/massivecraft/factions/zcore/persist/SaveTask.java +++ b/src/com/massivecraft/factions/zcore/persist/SaveTask.java @@ -12,8 +12,9 @@ public class SaveTask implements Runnable public void run() { - p.preSaveTask(); + if ( ! p.getAutoSave()) return; + p.preAutoSave(); EM.saveAllToDisc(); - p.postSaveTask(); + p.postAutoSave(); } }