From a84582ba219a286e71d9145dc950d3a19f134615 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Tue, 16 Apr 2013 10:30:21 +0200 Subject: [PATCH] More work at streamlining the command constructor content --- .../factions/cmd/CmdFactionsAccess.java | 7 +++---- .../factions/cmd/CmdFactionsAdmin.java | 4 +--- .../factions/cmd/CmdFactionsAutoClaim.java | 4 +--- .../massivecraft/factions/cmd/CmdFactionsCape.java | 2 -- .../factions/cmd/CmdFactionsCapeAbstract.java | 2 +- .../factions/cmd/CmdFactionsCapeRemove.java | 1 + .../factions/cmd/CmdFactionsCapeSet.java | 2 +- .../factions/cmd/CmdFactionsClaim.java | 8 ++------ .../factions/cmd/CmdFactionsCreate.java | 5 +---- .../factions/cmd/CmdFactionsDeinvite.java | 5 +---- .../factions/cmd/CmdFactionsDemote.java | 5 +---- .../factions/cmd/CmdFactionsDescription.java | 7 ++----- .../factions/cmd/CmdFactionsDisband.java | 5 +---- .../massivecraft/factions/cmd/CmdFactionsFlag.java | 9 +++------ .../massivecraft/factions/cmd/CmdFactionsHome.java | 7 ------- .../factions/cmd/CmdFactionsInvite.java | 5 +---- .../massivecraft/factions/cmd/CmdFactionsJoin.java | 6 ++---- .../massivecraft/factions/cmd/CmdFactionsKick.java | 5 +---- .../factions/cmd/CmdFactionsLeader.java | 6 ++---- .../factions/cmd/CmdFactionsLeave.java | 2 -- .../massivecraft/factions/cmd/CmdFactionsList.java | 5 +---- .../massivecraft/factions/cmd/CmdFactionsMap.java | 5 +---- .../factions/cmd/CmdFactionsMoney.java | 2 -- .../factions/cmd/CmdFactionsMoneyBalance.java | 10 +--------- .../factions/cmd/CmdFactionsMoneyDeposit.java | 11 ++--------- .../factions/cmd/CmdFactionsMoneyTransferFf.java | 13 +++---------- .../factions/cmd/CmdFactionsMoneyTransferFp.java | 13 +++---------- .../factions/cmd/CmdFactionsMoneyTransferPf.java | 13 +++---------- .../factions/cmd/CmdFactionsMoneyWithdraw.java | 9 ++------- .../factions/cmd/CmdFactionsOfficer.java | 5 +---- .../massivecraft/factions/cmd/CmdFactionsOpen.java | 5 +---- .../massivecraft/factions/cmd/CmdFactionsPerm.java | 14 +++++--------- .../factions/cmd/CmdFactionsPower.java | 5 +---- .../factions/cmd/CmdFactionsPowerBoost.java | 8 +++----- .../factions/cmd/CmdFactionsPromote.java | 5 +---- .../factions/cmd/CmdFactionsRelationAbstract.java | 2 -- .../factions/cmd/CmdFactionsRelationAlly.java | 5 +++-- .../factions/cmd/CmdFactionsRelationEnemy.java | 5 +++-- .../factions/cmd/CmdFactionsRelationNeutral.java | 5 +++-- .../factions/cmd/CmdFactionsRelationTruce.java | 5 +++-- .../factions/cmd/CmdFactionsSeeChunk.java | 3 --- .../factions/cmd/CmdFactionsSethome.java | 6 ++---- .../massivecraft/factions/cmd/CmdFactionsShow.java | 3 +-- .../massivecraft/factions/cmd/CmdFactionsTag.java | 2 +- .../factions/cmd/CmdFactionsTitle.java | 4 ++-- .../factions/cmd/CmdFactionsUnclaim.java | 1 - .../factions/cmd/CmdFactionsVersion.java | 1 + 47 files changed, 72 insertions(+), 190 deletions(-) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsAccess.java b/src/com/massivecraft/factions/cmd/CmdFactionsAccess.java index c794c407..1a65d570 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsAccess.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsAccess.java @@ -16,15 +16,14 @@ public class CmdFactionsAccess extends FCommand { public CmdFactionsAccess() { - super(); - this.addAliases("access"); - this.optionalArgs.put("view|p|player|f|faction", "view"); - this.optionalArgs.put("name", "you"); + this.addOptionalArg("view|p|player|f|faction", "view"); + this.addOptionalArg("name", "you"); this.setHelpShort("view or grant access for the claimed territory you are in"); + // TODO: Missing permission node here! this.addRequirements(ReqIsPlayer.get()); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsAdmin.java b/src/com/massivecraft/factions/cmd/CmdFactionsAdmin.java index 9f278311..7f2ac2e2 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsAdmin.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsAdmin.java @@ -8,11 +8,9 @@ public class CmdFactionsAdmin extends FCommand { public CmdFactionsAdmin() { - super(); - this.addAliases("admin"); - this.optionalArgs.put("on/off", "flip"); + this.addOptionalArg("on/off", "flip"); this.addRequirements(ReqHasPerm.get(Perm.ADMIN.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsAutoClaim.java b/src/com/massivecraft/factions/cmd/CmdFactionsAutoClaim.java index a3e5dab6..4496ff98 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsAutoClaim.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsAutoClaim.java @@ -10,11 +10,9 @@ public class CmdFactionsAutoClaim extends FCommand { public CmdFactionsAutoClaim() { - super(); - this.addAliases("autoclaim"); - this.optionalArgs.put("faction", "your"); + this.addOptionalArg("faction", "you"); this.addRequirements(ReqHasPerm.get(Perm.AUTOCLAIM.node)); this.addRequirements(ReqIsPlayer.get()); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsCape.java b/src/com/massivecraft/factions/cmd/CmdFactionsCape.java index 54f4a71f..0e73cfd6 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsCape.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsCape.java @@ -12,8 +12,6 @@ public class CmdFactionsCape extends FCommand public CmdFactionsCape() { - super(); - this.addAliases("cape"); this.addRequirements(ReqHasPerm.get(Perm.CAPE.node)); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsCapeAbstract.java b/src/com/massivecraft/factions/cmd/CmdFactionsCapeAbstract.java index 3b9b8ce8..6d62cb68 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsCapeAbstract.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsCapeAbstract.java @@ -14,7 +14,7 @@ public abstract class CmdFactionsCapeAbstract extends FCommand public CmdFactionsCapeAbstract() { - this.optionalArgs.put("faction", "your"); + this.addOptionalArg("faction", "you"); } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsCapeRemove.java b/src/com/massivecraft/factions/cmd/CmdFactionsCapeRemove.java index a46ba02f..f9af3155 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsCapeRemove.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsCapeRemove.java @@ -10,6 +10,7 @@ public class CmdFactionsCapeRemove extends CmdFactionsCapeAbstract public CmdFactionsCapeRemove() { this.addAliases("rm", "rem", "remove", "del", "delete"); + this.addRequirements(ReqHasPerm.get(Perm.CAPE_REMOVE.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsCapeSet.java b/src/com/massivecraft/factions/cmd/CmdFactionsCapeSet.java index 38a608a7..73b5c1b3 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsCapeSet.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsCapeSet.java @@ -14,7 +14,7 @@ public class CmdFactionsCapeSet extends CmdFactionsCapeAbstract { this.addAliases("set"); - this.requiredArgs.add("url"); + this.addRequiredArg("url"); this.addRequirements(ReqHasPerm.get(Perm.CAPE_SET.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsClaim.java b/src/com/massivecraft/factions/cmd/CmdFactionsClaim.java index a9863287..9999eed2 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsClaim.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsClaim.java @@ -14,16 +14,12 @@ public class CmdFactionsClaim extends FCommand public CmdFactionsClaim() { - super(); - this.addAliases("claim"); - //this.requiredArgs.add(""); - this.optionalArgs.put("faction", "your"); - this.optionalArgs.put("radius", "1"); + this.addOptionalArg("faction", "you"); + this.addOptionalArg("radius", "1"); this.addRequirements(ReqHasPerm.get(Perm.CLAIM.node)); - this.addRequirements(ReqIsPlayer.get()); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsCreate.java b/src/com/massivecraft/factions/cmd/CmdFactionsCreate.java index 942efcbc..ac3e9e3b 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsCreate.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsCreate.java @@ -21,12 +21,9 @@ public class CmdFactionsCreate extends FCommand { public CmdFactionsCreate() { - super(); - this.addAliases("create"); - this.requiredArgs.add("faction tag"); - //this.optionalArgs.put("", ""); + this.addRequiredArg("faction tag"); this.addRequirements(ReqHasPerm.get(Perm.CREATE.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsDeinvite.java b/src/com/massivecraft/factions/cmd/CmdFactionsDeinvite.java index b20afef3..0743908a 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsDeinvite.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsDeinvite.java @@ -9,12 +9,9 @@ public class CmdFactionsDeinvite extends FCommand public CmdFactionsDeinvite() { - super(); - this.addAliases("deinvite", "deinv"); - this.requiredArgs.add("player"); - //this.optionalArgs.put("", ""); + this.addRequiredArg("player"); this.addRequirements(ReqHasPerm.get(Perm.DEINVITE.node)); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsDemote.java b/src/com/massivecraft/factions/cmd/CmdFactionsDemote.java index 7a14576a..353af78f 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsDemote.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsDemote.java @@ -10,12 +10,9 @@ public class CmdFactionsDemote extends FCommand public CmdFactionsDemote() { - super(); - this.addAliases("demote"); - this.requiredArgs.add("player name"); - //this.optionalArgs.put("", ""); + this.addRequiredArg("player"); this.addRequirements(ReqHasPerm.get(Perm.DEMOTE.node)); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java b/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java index 8130e2f0..9029a786 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java @@ -11,13 +11,10 @@ public class CmdFactionsDescription extends FCommand { public CmdFactionsDescription() { - super(); - this.addAliases("desc"); - this.requiredArgs.add("desc"); - this.errorOnToManyArgs = false; - //this.optionalArgs + this.addRequiredArg("desc"); + this.setErrorOnToManyArgs(false); this.addRequirements(ReqHasPerm.get(Perm.DESCRIPTION.node)); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java b/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java index aaa9be49..5ff0d642 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java @@ -20,12 +20,9 @@ public class CmdFactionsDisband extends FCommand { public CmdFactionsDisband() { - super(); - this.addAliases("disband"); - //this.requiredArgs.add(""); - this.optionalArgs.put("faction", "your"); + this.addOptionalArg("faction", "you"); this.addRequirements(ReqHasPerm.get(Perm.DISBAND.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsFlag.java b/src/com/massivecraft/factions/cmd/CmdFactionsFlag.java index 313add27..9c342e46 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsFlag.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsFlag.java @@ -11,14 +11,11 @@ public class CmdFactionsFlag extends FCommand public CmdFactionsFlag() { - super(); - this.addAliases("flag"); - //this.requiredArgs.add(""); - this.optionalArgs.put("faction", "your"); - this.optionalArgs.put("flag", "all"); - this.optionalArgs.put("yes/no", "read"); + this.addOptionalArg("faction", "you"); + this.addOptionalArg("flag", "all"); + this.addOptionalArg("yes/no", "read"); this.addRequirements(ReqHasPerm.get(Perm.FLAG.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsHome.java b/src/com/massivecraft/factions/cmd/CmdFactionsHome.java index 674164c8..7c1604fc 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsHome.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsHome.java @@ -24,18 +24,11 @@ import com.massivecraft.mcore.util.SmokeUtil; public class CmdFactionsHome extends FCommand { - public CmdFactionsHome() { - super(); - this.addAliases("home"); - //this.requiredArgs.add(""); - //this.optionalArgs.put("", ""); - this.addRequirements(ReqHasPerm.get(Perm.HOME.node)); - this.addRequirements(ReqIsPlayer.get()); senderMustBeMember = true; diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsInvite.java b/src/com/massivecraft/factions/cmd/CmdFactionsInvite.java index fe9db894..8012e592 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsInvite.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsInvite.java @@ -11,12 +11,9 @@ public class CmdFactionsInvite extends FCommand { public CmdFactionsInvite() { - super(); - this.addAliases("inv", "invite"); - this.requiredArgs.add("player"); - //this.optionalArgs.put("", ""); + this.addRequiredArg("player"); this.addRequirements(ReqHasPerm.get(Perm.INVITE.node)); this.addRequirements(ReqIsPlayer.get()); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java b/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java index 17d94a28..302cc595 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java @@ -15,12 +15,10 @@ public class CmdFactionsJoin extends FCommand { public CmdFactionsJoin() { - super(); - this.addAliases("join"); - this.requiredArgs.add("faction"); - this.optionalArgs.put("player", "you"); + this.addRequiredArg("faction"); + this.addOptionalArg("player", "you"); this.addRequirements(ReqHasPerm.get(Perm.JOIN.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsKick.java b/src/com/massivecraft/factions/cmd/CmdFactionsKick.java index b32596c0..003545aa 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsKick.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsKick.java @@ -17,12 +17,9 @@ public class CmdFactionsKick extends FCommand public CmdFactionsKick() { - super(); - this.addAliases("kick"); - this.requiredArgs.add("player"); - //this.optionalArgs.put("", ""); + this.addRequiredArg("player"); this.addRequirements(ReqHasPerm.get(Perm.KICK.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java b/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java index a441b59b..f7139b28 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java @@ -16,12 +16,10 @@ public class CmdFactionsLeader extends FCommand { public CmdFactionsLeader() { - super(); - this.addAliases("leader"); - this.requiredArgs.add("player"); - this.optionalArgs.put("faction", "your"); + this.addRequiredArg("player"); + this.addOptionalArg("faction", "you"); this.addRequirements(ReqHasPerm.get(Perm.LEADER.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsLeave.java b/src/com/massivecraft/factions/cmd/CmdFactionsLeave.java index 2bf4b367..d6ecbb3d 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsLeave.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsLeave.java @@ -7,8 +7,6 @@ public class CmdFactionsLeave extends FCommand { public CmdFactionsLeave() { - super(); - this.addAliases("leave"); this.addRequirements(ReqHasPerm.get(Perm.LEAVE.node)); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsList.java b/src/com/massivecraft/factions/cmd/CmdFactionsList.java index b70b7c6f..b56c9d6b 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsList.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsList.java @@ -17,12 +17,9 @@ public class CmdFactionsList extends FCommand public CmdFactionsList() { - super(); - this.addAliases("ls", "list"); - //this.requiredArgs.add(""); - this.optionalArgs.put("page", "1"); + this.addOptionalArg("page", "1"); this.addRequirements(ReqHasPerm.get(Perm.LIST.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMap.java b/src/com/massivecraft/factions/cmd/CmdFactionsMap.java index 1d093b44..c2de6684 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMap.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMap.java @@ -12,14 +12,11 @@ public class CmdFactionsMap extends FCommand { public CmdFactionsMap() { - super(); - this.addAliases("map"); - this.optionalArgs.put("on/off", "once"); + this.addOptionalArg("on/off", "once"); this.addRequirements(ReqHasPerm.get(Perm.MAP.node)); - this.addRequirements(ReqIsPlayer.get()); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoney.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoney.java index dcadcad6..8581e760 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoney.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoney.java @@ -15,8 +15,6 @@ public class CmdFactionsMoney extends FCommand public CmdFactionsMoney() { - super(); - this.addAliases("money"); this.isMoneyCommand = true; diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyBalance.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyBalance.java index 368f7daf..bccbc264 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyBalance.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyBalance.java @@ -9,21 +9,13 @@ public class CmdFactionsMoneyBalance extends FCommand { public CmdFactionsMoneyBalance() { - super(); - this.addAliases("b", "balance"); - //this.requiredArgs.add(""); - this.optionalArgs.put("faction", "your"); + this.addOptionalArg("faction", "you"); this.addRequirements(ReqHasPerm.get(Perm.MONEY_BALANCE.node)); this.setHelpShort("show faction balance"); - - senderMustBePlayer = false; - senderMustBeMember = false; - senderMustBeOfficer = false; - senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java index 6e658040..6a16349a 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java @@ -16,21 +16,14 @@ public class CmdFactionsMoneyDeposit extends FCommand public CmdFactionsMoneyDeposit() { - super(); - this.addAliases("d", "deposit"); - this.requiredArgs.add("amount"); - this.optionalArgs.put("faction", "your"); + this.addRequiredArg("amount"); + this.addOptionalArg("faction", "you"); this.addRequirements(ReqHasPerm.get(Perm.MONEY_DEPOSIT.node)); this.setHelpShort("deposit money"); - - senderMustBePlayer = true; - senderMustBeMember = false; - senderMustBeOfficer = false; - senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java index f6f55543..6fa59f95 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java @@ -17,20 +17,13 @@ public class CmdFactionsMoneyTransferFf extends FCommand { this.addAliases("ff"); - this.requiredArgs.add("amount"); - this.requiredArgs.add("faction"); - this.requiredArgs.add("faction"); - - //this.optionalArgs.put("", ""); + this.addRequiredArg("amount"); + this.addRequiredArg("faction"); + this.addRequiredArg("faction"); this.addRequirements(ReqHasPerm.get(Perm.MONEY_F2F.node)); this.setHelpShort("transfer f -> f"); - - senderMustBePlayer = false; - senderMustBeMember = false; - senderMustBeOfficer = false; - senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java index c7beb92c..5bc389aa 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java @@ -17,20 +17,13 @@ public class CmdFactionsMoneyTransferFp extends FCommand { this.addAliases("fp"); - this.requiredArgs.add("amount"); - this.requiredArgs.add("faction"); - this.requiredArgs.add("player"); - - //this.optionalArgs.put("", ""); + this.addRequiredArg("amount"); + this.addRequiredArg("faction"); + this.addRequiredArg("player"); this.addRequirements(ReqHasPerm.get(Perm.MONEY_F2P.node)); this.setHelpShort("transfer f -> p"); - - senderMustBePlayer = false; - senderMustBeMember = false; - senderMustBeOfficer = false; - senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java index 190cc426..fae7f1f5 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java @@ -17,20 +17,13 @@ public class CmdFactionsMoneyTransferPf extends FCommand { this.addAliases("pf"); - this.requiredArgs.add("amount"); - this.requiredArgs.add("player"); - this.requiredArgs.add("faction"); - - //this.optionalArgs.put("", ""); + this.addRequiredArg("amount"); + this.addRequiredArg("player"); + this.addRequiredArg("faction"); this.addRequirements(ReqHasPerm.get(Perm.MONEY_P2F.node)); this.setHelpShort("transfer p -> f"); - - senderMustBePlayer = false; - senderMustBeMember = false; - senderMustBeOfficer = false; - senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java index c3e3b1db..1b614e47 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java @@ -17,17 +17,12 @@ public class CmdFactionsMoneyWithdraw extends FCommand { this.addAliases("w", "withdraw"); - this.requiredArgs.add("amount"); - this.optionalArgs.put("faction", "your"); + this.addRequiredArg("amount"); + this.addOptionalArg("faction", "you"); this.addRequirements(ReqHasPerm.get(Perm.MONEY_WITHDRAW.node)); this.setHelpShort("withdraw money"); - - senderMustBePlayer = true; - senderMustBeMember = false; - senderMustBeOfficer = false; - senderMustBeLeader = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsOfficer.java b/src/com/massivecraft/factions/cmd/CmdFactionsOfficer.java index 22951b6e..8d505c2e 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsOfficer.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsOfficer.java @@ -11,12 +11,9 @@ public class CmdFactionsOfficer extends FCommand public CmdFactionsOfficer() { - super(); - this.addAliases("officer"); - this.requiredArgs.add("player name"); - //this.optionalArgs.put("", ""); + this.addRequiredArg("player"); this.addRequirements(ReqHasPerm.get(Perm.OFFICER.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java b/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java index e083427f..3faf8bc7 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java @@ -10,12 +10,9 @@ public class CmdFactionsOpen extends FCommand { public CmdFactionsOpen() { - super(); - this.addAliases("open"); - //this.requiredArgs.add(""); - this.optionalArgs.put("yes/no", "flip"); + this.addOptionalArg("yes/no", "toggle"); this.addRequirements(ReqHasPerm.get(Perm.OPEN.node)); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java b/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java index ad6fc351..8dc3110d 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java @@ -9,21 +9,17 @@ import com.massivecraft.mcore.util.Txt; public class CmdFactionsPerm extends FCommand { - public CmdFactionsPerm() { - super(); - this.addAliases("perm"); - this.optionalArgs.put("faction", "your"); - this.optionalArgs.put("perm", "all"); - this.optionalArgs.put("relation", "read"); - this.optionalArgs.put("yes/no", "read"); + this.addOptionalArg("faction", "your"); + this.addOptionalArg("perm", "all"); + this.addOptionalArg("relation", "read"); + this.addOptionalArg("yes/no", "read"); + this.setErrorOnToManyArgs(false); this.addRequirements(ReqHasPerm.get(Perm.PERM.node)); - - this.errorOnToManyArgs = false; } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsPower.java b/src/com/massivecraft/factions/cmd/CmdFactionsPower.java index 7de22880..1faa6e5f 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsPower.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsPower.java @@ -10,12 +10,9 @@ public class CmdFactionsPower extends FCommand public CmdFactionsPower() { - super(); - this.addAliases("power", "pow"); - //this.requiredArgs.add("faction tag"); - this.optionalArgs.put("player", "you"); + this.addOptionalArg("player", "you"); this.addRequirements(ReqHasPerm.get(Perm.POWER.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsPowerBoost.java b/src/com/massivecraft/factions/cmd/CmdFactionsPowerBoost.java index 6eb24f80..d9c234b9 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsPowerBoost.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsPowerBoost.java @@ -10,13 +10,11 @@ public class CmdFactionsPowerBoost extends FCommand { public CmdFactionsPowerBoost() { - super(); - this.addAliases("powerboost"); - this.requiredArgs.add("p|f|player|faction"); - this.requiredArgs.add("name"); - this.requiredArgs.add("#"); + this.addRequiredArg("p|f|player|faction"); + this.addRequiredArg("name"); + this.addRequiredArg("#"); this.addRequirements(ReqHasPerm.get(Perm.POWERBOOST.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsPromote.java b/src/com/massivecraft/factions/cmd/CmdFactionsPromote.java index 5befcb51..2b7ee866 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsPromote.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsPromote.java @@ -10,12 +10,9 @@ public class CmdFactionsPromote extends FCommand public CmdFactionsPromote() { - super(); - this.addAliases("promote"); - this.requiredArgs.add("player name"); - //this.optionalArgs.put("", ""); + this.addRequiredArg("player"); this.addRequirements(ReqHasPerm.get(Perm.PROMOTE.node)); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsRelationAbstract.java b/src/com/massivecraft/factions/cmd/CmdFactionsRelationAbstract.java index b2a6c16b..36c24915 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsRelationAbstract.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsRelationAbstract.java @@ -18,8 +18,6 @@ public abstract class CmdFactionsRelationAbstract extends FCommand public CmdFactionsRelationAbstract() { - super(); - this.addAliases("faction"); this.addRequirements(ReqHasPerm.get(Perm.RELATION.node)); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsRelationAlly.java b/src/com/massivecraft/factions/cmd/CmdFactionsRelationAlly.java index 6e8f47fd..87c33220 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsRelationAlly.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsRelationAlly.java @@ -6,7 +6,8 @@ public class CmdFactionsRelationAlly extends CmdFactionsRelationAbstract { public CmdFactionsRelationAlly() { - aliases.add("ally"); - targetRelation = Rel.ALLY; + this.addAliases("ally"); + + this.targetRelation = Rel.ALLY; } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsRelationEnemy.java b/src/com/massivecraft/factions/cmd/CmdFactionsRelationEnemy.java index 0e210b58..ec4dd181 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsRelationEnemy.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsRelationEnemy.java @@ -6,7 +6,8 @@ public class CmdFactionsRelationEnemy extends CmdFactionsRelationAbstract { public CmdFactionsRelationEnemy() { - aliases.add("enemy"); - targetRelation = Rel.ENEMY; + this.addAliases("enemy"); + + this.targetRelation = Rel.ENEMY; } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsRelationNeutral.java b/src/com/massivecraft/factions/cmd/CmdFactionsRelationNeutral.java index 92f9ccc9..f616f45c 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsRelationNeutral.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsRelationNeutral.java @@ -6,7 +6,8 @@ public class CmdFactionsRelationNeutral extends CmdFactionsRelationAbstract { public CmdFactionsRelationNeutral() { - aliases.add("neutral"); - targetRelation = Rel.NEUTRAL; + this.addAliases("neutral"); + + this.targetRelation = Rel.NEUTRAL; } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsRelationTruce.java b/src/com/massivecraft/factions/cmd/CmdFactionsRelationTruce.java index 918399b5..a9105dee 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsRelationTruce.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsRelationTruce.java @@ -6,7 +6,8 @@ public class CmdFactionsRelationTruce extends CmdFactionsRelationAbstract { public CmdFactionsRelationTruce() { - aliases.add("truce"); - targetRelation = Rel.TRUCE; + this.addAliases("truce"); + + this.targetRelation = Rel.TRUCE; } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunk.java b/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunk.java index 62cf8646..79ffb8b0 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunk.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunk.java @@ -14,12 +14,9 @@ public class CmdFactionsSeeChunk extends FCommand { public CmdFactionsSeeChunk() { - super(); - this.addAliases("sc", "seechunk"); this.addRequirements(ReqHasPerm.get(Perm.SEE_CHUNK.node)); - this.addRequirements(ReqIsPlayer.get()); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsSethome.java b/src/com/massivecraft/factions/cmd/CmdFactionsSethome.java index 654b9cf7..f9d6f97b 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsSethome.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsSethome.java @@ -15,12 +15,10 @@ public class CmdFactionsSethome extends FCommand { this.addAliases("sethome"); - //this.requiredArgs.add(""); - this.optionalArgs.put("faction", "your"); - - this.addRequirements(ReqHasPerm.get(Perm.SETHOME.node)); + this.addOptionalArg("faction", "you"); this.addRequirements(ReqIsPlayer.get()); + this.addRequirements(ReqHasPerm.get(Perm.SETHOME.node)); } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java b/src/com/massivecraft/factions/cmd/CmdFactionsShow.java index f588ca70..414184a1 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsShow.java @@ -22,8 +22,7 @@ public class CmdFactionsShow extends FCommand { this.addAliases("show", "who"); - //this.requiredArgs.add(""); - this.optionalArgs.put("faction", "your"); + this.addOptionalArg("faction", "you"); this.addRequirements(ReqHasPerm.get(Perm.SHOW.node)); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsTag.java b/src/com/massivecraft/factions/cmd/CmdFactionsTag.java index 4296b22c..2271a304 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsTag.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsTag.java @@ -20,7 +20,7 @@ public class CmdFactionsTag extends FCommand { this.addAliases("tag"); - this.requiredArgs.add("new tag"); + this.addRequiredArg("new tag"); this.addRequirements(ReqHasPerm.get(Perm.TAG.node)); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java b/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java index 7c5eba21..fde60ad7 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsTitle.java @@ -13,8 +13,8 @@ public class CmdFactionsTitle extends FCommand { this.addAliases("title"); - this.requiredArgs.add("player"); - this.optionalArgs.put("title", ""); + this.addRequiredArg("player"); + this.addOptionalArg("title", ""); this.addRequirements(ReqHasPerm.get(Perm.TITLE.node)); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsUnclaim.java b/src/com/massivecraft/factions/cmd/CmdFactionsUnclaim.java index 48f904af..9c70d88f 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsUnclaim.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsUnclaim.java @@ -22,7 +22,6 @@ public class CmdFactionsUnclaim extends FCommand this.addAliases("unclaim", "declaim"); this.addRequirements(ReqHasPerm.get(Perm.UNCLAIM.node)); - this.addRequirements(ReqIsPlayer.get()); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsVersion.java b/src/com/massivecraft/factions/cmd/CmdFactionsVersion.java index 98a6ded2..1f8121d8 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsVersion.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsVersion.java @@ -10,6 +10,7 @@ public class CmdFactionsVersion extends FCommand public CmdFactionsVersion() { this.addAliases("version"); + this.addRequirements(ReqHasPerm.get(Perm.VERSION.node)); }