More work at streamlining the command constructor content

This commit is contained in:
Olof Larsson 2013-04-16 10:30:21 +02:00
parent 4c0adc523a
commit a84582ba21
47 changed files with 72 additions and 190 deletions

View File

@ -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());
}

View File

@ -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));
}

View File

@ -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());

View File

@ -12,8 +12,6 @@ public class CmdFactionsCape extends FCommand
public CmdFactionsCape()
{
super();
this.addAliases("cape");
this.addRequirements(ReqHasPerm.get(Perm.CAPE.node));

View File

@ -14,7 +14,7 @@ public abstract class CmdFactionsCapeAbstract extends FCommand
public CmdFactionsCapeAbstract()
{
this.optionalArgs.put("faction", "your");
this.addOptionalArg("faction", "you");
}
@Override

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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());
}

View File

@ -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));
}

View File

@ -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));

View File

@ -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));

View File

@ -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));

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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;

View File

@ -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());

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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));
}

View File

@ -7,8 +7,6 @@ public class CmdFactionsLeave extends FCommand {
public CmdFactionsLeave()
{
super();
this.addAliases("leave");
this.addRequirements(ReqHasPerm.get(Perm.LEAVE.node));

View File

@ -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));
}

View File

@ -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());
}

View File

@ -15,8 +15,6 @@ public class CmdFactionsMoney extends FCommand
public CmdFactionsMoney()
{
super();
this.addAliases("money");
this.isMoneyCommand = true;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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));
}

View File

@ -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));

View File

@ -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

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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));

View File

@ -18,8 +18,6 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
public CmdFactionsRelationAbstract()
{
super();
this.addAliases("faction");
this.addRequirements(ReqHasPerm.get(Perm.RELATION.node));

View File

@ -6,7 +6,8 @@ public class CmdFactionsRelationAlly extends CmdFactionsRelationAbstract
{
public CmdFactionsRelationAlly()
{
aliases.add("ally");
targetRelation = Rel.ALLY;
this.addAliases("ally");
this.targetRelation = Rel.ALLY;
}
}

View File

@ -6,7 +6,8 @@ public class CmdFactionsRelationEnemy extends CmdFactionsRelationAbstract
{
public CmdFactionsRelationEnemy()
{
aliases.add("enemy");
targetRelation = Rel.ENEMY;
this.addAliases("enemy");
this.targetRelation = Rel.ENEMY;
}
}

View File

@ -6,7 +6,8 @@ public class CmdFactionsRelationNeutral extends CmdFactionsRelationAbstract
{
public CmdFactionsRelationNeutral()
{
aliases.add("neutral");
targetRelation = Rel.NEUTRAL;
this.addAliases("neutral");
this.targetRelation = Rel.NEUTRAL;
}
}

View File

@ -6,7 +6,8 @@ public class CmdFactionsRelationTruce extends CmdFactionsRelationAbstract
{
public CmdFactionsRelationTruce()
{
aliases.add("truce");
targetRelation = Rel.TRUCE;
this.addAliases("truce");
this.targetRelation = Rel.TRUCE;
}
}

View File

@ -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());
}

View File

@ -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

View File

@ -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));
}

View File

@ -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));

View File

@ -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));

View File

@ -22,7 +22,6 @@ public class CmdFactionsUnclaim extends FCommand
this.addAliases("unclaim", "declaim");
this.addRequirements(ReqHasPerm.get(Perm.UNCLAIM.node));
this.addRequirements(ReqIsPlayer.get());
}

View File

@ -10,6 +10,7 @@ public class CmdFactionsVersion extends FCommand
public CmdFactionsVersion()
{
this.addAliases("version");
this.addRequirements(ReqHasPerm.get(Perm.VERSION.node));
}