MassiveCore Change

This commit is contained in:
Magnus Ulf 2015-05-06 17:04:35 +02:00 committed by Olof Larsson
parent fef69f347e
commit 22cb629107
51 changed files with 239 additions and 232 deletions

View File

@ -21,8 +21,8 @@ public class CmdFactionsAccessFaction extends CmdFactionsAccessAbstract
this.addAliases("f", "faction");
// Args
this.addRequiredArg("faction");
this.addOptionalArg("yes/no", "toggle");
this.addArg(ARFaction.get(), "faction");
this.addArg(ARBoolean.get(), "yes/no", "toggle");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.ACCESS_FACTION.node));
@ -36,8 +36,8 @@ public class CmdFactionsAccessFaction extends CmdFactionsAccessAbstract
public void innerPerform() throws MassiveException
{
// Args
Faction faction = this.arg(0, ARFaction.get());
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isFactionIdGranted(faction.getId()));
Faction faction = this.readArg();
boolean newValue = this.readArg(!ta.isFactionIdGranted(faction.getId()));
// MPerm
if (!MPerm.getPermAccess().has(msender, hostFaction, true)) return;

View File

@ -21,8 +21,8 @@ public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
this.addAliases("p", "player");
// Args
this.addRequiredArg("player");
this.addOptionalArg("yes/no", "toggle");
this.addArg(ARMPlayer.getAny(), "player");
this.addArg(ARBoolean.get(), "yes/no", "toggle");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.ACCESS_PLAYER.node));
@ -36,8 +36,8 @@ public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
public void innerPerform() throws MassiveException
{
// Args
MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isPlayerIdGranted(mplayer.getId()));
MPlayer mplayer = this.readArg();
boolean newValue = this.readArg(!ta.isPlayerIdGranted(mplayer.getId()));
// MPerm
if (!MPerm.getPermAccess().has(msender, hostFaction, true)) return;

View File

@ -20,7 +20,7 @@ public class CmdFactionsAdmin extends FactionsCommand
this.addAliases("admin");
// Args
this.addOptionalArg("on/off", "flip");
this.addArg(ARBoolean.get(), "on/off", "flip");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.ADMIN.node));
@ -34,7 +34,7 @@ public class CmdFactionsAdmin extends FactionsCommand
public void perform() throws MassiveException
{
// Args
Boolean target = this.arg(0, ARBoolean.get(), !msender.isUsingAdminMode());
boolean target = this.readArg(!msender.isUsingAdminMode());
// Apply
msender.setUsingAdminMode(target);

View File

@ -12,6 +12,8 @@ import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.EventFactionsCreate;
import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.arg.ARString;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.store.MStore;
@ -27,7 +29,7 @@ public class CmdFactionsCreate extends FactionsCommand
this.addAliases("create");
// Args
this.addRequiredArg("name");
this.addArg(ARString.get(), "name");
// Requirements
this.addRequirements(ReqHasntFaction.get());
@ -39,10 +41,10 @@ public class CmdFactionsCreate extends FactionsCommand
// -------------------------------------------- //
@Override
public void perform()
public void perform() throws MassiveException
{
// Args
String newName = this.arg(0);
String newName = this.readArg();
// Verify
if (FactionColl.get().isNameTaken(newName))

View File

@ -5,6 +5,8 @@ import com.massivecraft.factions.cmd.req.ReqHasFaction;
import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsDescriptionChange;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.arg.ARString;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.mixin.Mixin;
@ -20,8 +22,7 @@ public class CmdFactionsDescription extends FactionsCommand
this.addAliases("desc");
// Args
this.addRequiredArg("desc");
this.setErrorOnToManyArgs(false);
this.addArg(ARString.get(), "desc", true);
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.DESCRIPTION.node));
@ -33,10 +34,10 @@ public class CmdFactionsDescription extends FactionsCommand
// -------------------------------------------- //
@Override
public void perform()
public void perform() throws MassiveException
{
// Args
String newDescription = this.argConcatFrom(0);
String newDescription = this.readArg();
// MPerm
if ( ! MPerm.getPermDesc().has(msender, msenderFaction, true)) return;

View File

@ -29,7 +29,7 @@ public class CmdFactionsDisband extends FactionsCommand
this.addAliases("disband");
// Args
this.addOptionalArg("faction", "you");
this.addArg(ARFaction.get(), "faction", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.DISBAND.node));
@ -43,7 +43,7 @@ public class CmdFactionsDisband extends FactionsCommand
public void perform() throws MassiveException
{
// Args
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
Faction faction = this.readArg(msenderFaction);
// MPerm
if ( ! MPerm.getPermDisband().has(msender, faction, true)) return;

View File

@ -28,7 +28,7 @@ public class CmdFactionsFaction extends FactionsCommand
this.addAliases("f", "faction");
// Args
this.addOptionalArg("faction", "you");
this.addArg(ARFaction.get(), "faction", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.FACTION.node));
@ -42,7 +42,7 @@ public class CmdFactionsFaction extends FactionsCommand
public void perform() throws MassiveException
{
// Args
final Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
final Faction faction = this.readArg(msenderFaction);
final CommandSender sender = this.sender;

View File

@ -22,7 +22,7 @@ public class CmdFactionsFlagList extends FactionsCommand
this.addAliases("l", "list");
// Args
this.addOptionalArg("page", "1");
this.addArg(ARInteger.get(), "page", "1");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.FLAG_LIST.node));
@ -36,7 +36,7 @@ public class CmdFactionsFlagList extends FactionsCommand
public void perform() throws MassiveException
{
// Args
Integer pageHumanBased = this.arg(0, ARInteger.get(), 1);
int pageHumanBased = this.readArg(1);
//Create messages
List<String> messages = new ArrayList<String>();

View File

@ -23,9 +23,9 @@ public class CmdFactionsFlagSet extends FactionsCommand
this.addAliases("set");
// Args
this.addRequiredArg("flag");
this.addRequiredArg("yes/no");
this.addOptionalArg("faction", "you");
this.addArg(ARMFlag.get(), "flag");
this.addArg(ARBoolean.get(), "yes/no");
this.addArg(ARFaction.get(), "faction", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.FLAG_SET.node));
@ -39,9 +39,9 @@ public class CmdFactionsFlagSet extends FactionsCommand
public void perform() throws MassiveException
{
// Args
MFlag flag = this.arg(0, ARMFlag.get());
Boolean value = this.arg(1, ARBoolean.get());
Faction faction = this.arg(2, ARFaction.get(), msenderFaction);
MFlag flag = this.readArg();
boolean value = this.readArg();
Faction faction = this.readArg(msenderFaction);
// Do the sender have the right to change flags for this faction?
if ( ! MPerm.getPermFlags().has(msender, faction, true)) return;

View File

@ -1,6 +1,7 @@
package com.massivecraft.factions.cmd;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import com.massivecraft.factions.Perm;
@ -9,7 +10,8 @@ import com.massivecraft.factions.cmd.arg.ARMFlag;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MFlag;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.arg.ARList;
import com.massivecraft.massivecore.cmd.arg.ARAll;
import com.massivecraft.massivecore.cmd.arg.ARSet;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
@ -25,9 +27,8 @@ public class CmdFactionsFlagShow extends FactionsCommand
this.addAliases("s", "show");
// Args
this.addOptionalArg("faction", "you");
this.addOptionalArg("flags", "all");
this.setErrorOnToManyArgs(false);
this.addArg(ARFaction.get(), "faction", "you");
this.addArg(ARAll.get(ARSet.get(ARMFlag.get(), false)), "flags", "all", true);
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.FLAG_SHOW.node));
@ -41,30 +42,13 @@ public class CmdFactionsFlagShow extends FactionsCommand
public void perform() throws MassiveException
{
// Arg: Faction
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
List<MFlag> flags = new ArrayList<MFlag>();
// Case: Show All
if ( ! this.argIsSet(1) || "all".equalsIgnoreCase(this.arg(1)))
{
for (MFlag mflag : MFlag.getAll())
{
if (!mflag.isVisible() && ! msender.isUsingAdminMode()) continue;
flags.add(mflag);
}
}
else
{
// Arg: MFlag. Maybe we should use ARSet but that is currently buggy.
List<MFlag> mflags = this.arg(this.argConcatFrom(1), ARList.get(ARMFlag.get()));
flags.addAll(mflags);
}
Faction faction = this.readArg(msenderFaction);
Collection<MFlag> mflags = this.readArg(MFlag.getAll());
// Create messages
List<String> messages = new ArrayList<String>();
messages.add(Txt.titleize("Flag for " + faction.describeTo(msender, true)));
for (MFlag mflag : flags)
for (MFlag mflag : mflags)
{
messages.add(mflag.getStateDesc(faction.getFlag(mflag), true, true, true, true, true));
}

View File

@ -37,7 +37,7 @@ public class CmdFactionsHome extends FactionsCommandHome
this.addAliases("home");
// Args
this.addOptionalArg("faction", "you");
this.addArg(ARFaction.get(), "faction", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.HOME.node));
@ -58,7 +58,7 @@ public class CmdFactionsHome extends FactionsCommandHome
}
// Args
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
Faction faction = this.readArg(msenderFaction);
PS home = faction.getHome();
String homeDesc = "home for " + faction.describeTo(msender, false);

View File

@ -1,6 +1,6 @@
package com.massivecraft.factions.cmd;
import java.util.Set;
import java.util.Collection;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
@ -23,8 +23,7 @@ public class CmdFactionsInviteAdd extends FactionsCommand
this.addAliases("a", "add");
// Args
this.addRequiredArg("players");
this.setErrorOnToManyArgs(false);
this.addArg(ARSet.get(ARMPlayer.getAny(), true), "players", true);
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.INVITE_ADD.node));
@ -38,7 +37,7 @@ public class CmdFactionsInviteAdd extends FactionsCommand
public void perform() throws MassiveException
{
// Args
Set<MPlayer> mplayers = this.argConcatFrom(0, ARSet.get(ARMPlayer.getAny(), true));
Collection<MPlayer> mplayers = this.readArg();
// MPerm
if ( ! MPerm.getPermInvite().has(msender, msenderFaction, true)) return;

View File

@ -27,8 +27,8 @@ public class CmdFactionsInviteList extends FactionsCommand
this.addAliases("l", "list");
// Args
this.addOptionalArg("page", "1");
this.addOptionalArg("faction", "you");
this.addArg(ARInteger.get(), "page", "1");
this.addArg(ARFaction.get(), "faction", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.INVITE_LIST.node));
@ -42,9 +42,9 @@ public class CmdFactionsInviteList extends FactionsCommand
public void perform() throws MassiveException
{
// Args
Integer pageHumanBased = this.arg(0, ARInteger.get(), 1);
int pageHumanBased = this.readArg(1);
Faction faction = this.arg(1, ARFaction.get(), msenderFaction);
Faction faction = this.readArg(msenderFaction);
if ( faction != msenderFaction && ! Perm.INVITE_LIST_OTHER.has(sender, true)) return;

View File

@ -12,7 +12,6 @@ import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsInvitedChange;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.arg.ARSet;
import com.massivecraft.massivecore.cmd.arg.ARString;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsInviteRemove extends FactionsCommand
@ -26,8 +25,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand
this.addAliases("r", "remove");
// Args
this.addRequiredArg("players/all");
this.setErrorOnToManyArgs(false);
this.addArg(ARSet.get(ARMPlayer.getAny(), true), "players/all", true);
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.INVITE_REMOVE.node));
@ -44,7 +42,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand
boolean all = false;
// Args
if (this.arg(0, ARString.get()).equalsIgnoreCase("all"))
if ("all".equalsIgnoreCase(this.argAt(0)))
{
List<MPlayer> invitedPlayers = msenderFaction.getInvitedMPlayers();
// Doesn't show up if list is empty. Test at home if it worked.
@ -58,9 +56,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand
}
else
{
Set<MPlayer> senderInput = this.argConcatFrom(0, ARSet.get(ARMPlayer.getAny(), true));
mplayers.addAll(senderInput);
mplayers = this.readArgAt(0);
}
// MPerm

View File

@ -26,8 +26,8 @@ public class CmdFactionsJoin extends FactionsCommand
this.addAliases("join");
// Args
this.addRequiredArg("faction");
this.addOptionalArg("player", "you");
this.addArg(ARFaction.get(), "faction");
this.addArg(ARMPlayer.getAny(), "player", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.JOIN.node));
@ -41,9 +41,9 @@ public class CmdFactionsJoin extends FactionsCommand
public void perform() throws MassiveException
{
// Args
Faction faction = this.arg(0, ARFaction.get());
Faction faction = this.readArg();
MPlayer mplayer = this.arg(1, ARMPlayer.getAny(), msender);
MPlayer mplayer = this.readArg(msender);
Faction mplayerFaction = mplayer.getFaction();
boolean samePlayer = mplayer == msender;

View File

@ -27,7 +27,7 @@ public class CmdFactionsKick extends FactionsCommand
this.addAliases("kick");
// Args
this.addRequiredArg("player");
this.addArg(ARMPlayer.getAny(), "player");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.KICK.node));
@ -41,7 +41,7 @@ public class CmdFactionsKick extends FactionsCommand
public void perform() throws MassiveException
{
// Arg
MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
MPlayer mplayer = this.readArg();
// Validate
if (msender == mplayer)

View File

@ -30,7 +30,7 @@ public class CmdFactionsList extends FactionsCommand
this.addAliases("l", "list");
// Args
this.addOptionalArg("page", "1");
this.addArg(ARInteger.get(), "page", "1");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.LIST.node));
@ -44,7 +44,7 @@ public class CmdFactionsList extends FactionsCommand
public void perform() throws MassiveException
{
// Args
final Integer pageHumanBased = this.arg(0, ARInteger.get(), 1);
final int pageHumanBased = this.readArg(1);
// NOTE: The faction list is quite slow and mostly thread safe.
// We run it asynchronously to spare the primary server thread.

View File

@ -25,7 +25,7 @@ public class CmdFactionsMap extends FactionsCommand
this.addAliases("map");
// Args
this.addOptionalArg("on/off", "once");
this.addArg(ARBoolean.get(), "on/off", "once");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.MAP.node));
@ -39,13 +39,13 @@ public class CmdFactionsMap extends FactionsCommand
@Override
public void perform() throws MassiveException
{
if ( ! this.argIsSet(0))
if ( ! this.argIsSet())
{
showMap(Const.MAP_WIDTH, Const.MAP_HEIGHT_FULL);
return;
}
if (this.arg(0, ARBoolean.get(), !msender.isMapAutoUpdating()))
if (this.readArg(!msender.isMapAutoUpdating()))
{
// And show the map once
showMap(Const.MAP_WIDTH, Const.MAP_HEIGHT);

View File

@ -20,7 +20,7 @@ public class CmdFactionsMoneyBalance extends FactionsCommand
this.addAliases("b", "balance");
// Args
this.addOptionalArg("faction", "you");
this.addArg(ARFaction.get(), "faction", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.MONEY_BALANCE.node));
@ -34,7 +34,7 @@ public class CmdFactionsMoneyBalance extends FactionsCommand
@Override
public void perform() throws MassiveException
{
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
Faction faction = this.readArg(msenderFaction);
if (faction != msenderFaction && ! Perm.MONEY_BALANCE_ANY.has(sender, true)) return;

View File

@ -27,8 +27,8 @@ public class CmdFactionsMoneyDeposit extends FactionsCommand
this.addAliases("d", "deposit");
// Args
this.addRequiredArg("amount");
this.addOptionalArg("faction", "you");
this.addArg(ARDouble.get(), "amount");
this.addArg(ARFaction.get(), "faction", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.MONEY_DEPOSIT.node));
@ -42,9 +42,9 @@ public class CmdFactionsMoneyDeposit extends FactionsCommand
@Override
public void perform() throws MassiveException
{
Double amount = this.arg(0, ARDouble.get());
double amount = this.readArg();
Faction faction = this.arg(1, ARFaction.get(), msenderFaction);
Faction faction = this.readArg(msenderFaction);
boolean success = Econ.transferMoney(msender, msender, faction, amount);

View File

@ -28,9 +28,9 @@ public class CmdFactionsMoneyTransferFf extends FactionsCommand
this.addAliases("ff");
// Args
this.addRequiredArg("amount");
this.addRequiredArg("faction");
this.addRequiredArg("faction");
this.addArg(ARDouble.get(), "amount");
this.addArg(ARFaction.get(), "faction");
this.addArg(ARFaction.get(), "faction");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.MONEY_F2F.node));
@ -44,9 +44,9 @@ public class CmdFactionsMoneyTransferFf extends FactionsCommand
@Override
public void perform() throws MassiveException
{
Double amount = this.arg(0, ARDouble.get());
Faction from = this.arg(1, ARFaction.get());
Faction to = this.arg(2, ARFaction.get());
double amount = this.readArg();
Faction from = this.readArg();
Faction to = this.readArg();
boolean success = Econ.transferMoney(msender, from, to, amount);

View File

@ -30,9 +30,9 @@ public class CmdFactionsMoneyTransferFp extends FactionsCommand
this.addAliases("fp");
// Args
this.addRequiredArg("amount");
this.addRequiredArg("faction");
this.addRequiredArg("player");
this.addArg(ARDouble.get(), "amount");
this.addArg(ARFaction.get(), "faction");
this.addArg(ARMPlayer.getAny(), "player");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.MONEY_F2P.node));
@ -46,9 +46,9 @@ public class CmdFactionsMoneyTransferFp extends FactionsCommand
@Override
public void perform() throws MassiveException
{
Double amount = this.arg(0, ARDouble.get());
Faction from = this.arg(1, ARFaction.get());
MPlayer to = this.arg(2, ARMPlayer.getAny());
double amount = this.readArg();
Faction from = this.readArg();
MPlayer to = this.readArg();
boolean success = Econ.transferMoney(msender, from, to, amount);

View File

@ -30,9 +30,9 @@ public class CmdFactionsMoneyTransferPf extends FactionsCommand
this.addAliases("pf");
// Args
this.addRequiredArg("amount");
this.addRequiredArg("player");
this.addRequiredArg("faction");
this.addArg(ARDouble.get(), "amount");
this.addArg(ARMPlayer.getAny(), "player");
this.addArg(ARFaction.get(), "faction");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.MONEY_P2F.node));
@ -46,9 +46,9 @@ public class CmdFactionsMoneyTransferPf extends FactionsCommand
@Override
public void perform() throws MassiveException
{
Double amount = this.arg(0, ARDouble.get());
MPlayer from = this.arg(1, ARMPlayer.getAny());
Faction to = this.arg(2, ARFaction.get());
double amount = this.readArg();
MPlayer from = this.readArg();
Faction to = this.readArg();
boolean success = Econ.transferMoney(msender, from, to, amount);

View File

@ -29,8 +29,8 @@ public class CmdFactionsMoneyWithdraw extends FactionsCommand
this.addAliases("w", "withdraw");
// Args
this.addRequiredArg("amount");
this.addOptionalArg("faction", "you");
this.addArg(ARDouble.get(), "amount");
this.addArg(ARFaction.get(), "faction", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.MONEY_WITHDRAW.node));
@ -44,8 +44,8 @@ public class CmdFactionsMoneyWithdraw extends FactionsCommand
@Override
public void perform() throws MassiveException
{
Double amount = this.arg(0, ARDouble.get());
Faction from = this.arg(1, ARFaction.get(), msenderFaction);
Double amount = this.readArg();
Faction from = this.readArg(msenderFaction);
MPlayer to = msender;

View File

@ -5,6 +5,8 @@ import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsMotdChange;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.arg.ARString;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.util.MUtil;
@ -22,8 +24,7 @@ public class CmdFactionsMotd extends FactionsCommand
this.addAliases("motd");
// Args
this.addOptionalArg("new", "read");
this.setErrorOnToManyArgs(false);
this.addArg(ARString.get(), "new", "read", true);
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.MOTD.node));
@ -34,7 +35,7 @@ public class CmdFactionsMotd extends FactionsCommand
// -------------------------------------------- //
@Override
public void perform()
public void perform() throws MassiveException
{
// Read
if ( ! this.argIsSet(0))
@ -47,7 +48,7 @@ public class CmdFactionsMotd extends FactionsCommand
if ( ! MPerm.getPermMotd().has(msender, msenderFaction, true)) return;
// Args
String target = this.argConcatFrom(0);
String target = this.readArg();
target = target.trim();
target = Txt.parse(target);

View File

@ -10,6 +10,7 @@ import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.event.EventFactionsNameChange;
import com.massivecraft.factions.util.MiscUtil;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.arg.ARString;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsName extends FactionsCommand
@ -24,8 +25,8 @@ public class CmdFactionsName extends FactionsCommand
this.addAliases("name");
// Args
this.addRequiredArg("new name");
this.addOptionalArg("faction", "you");
this.addArg(ARString.get(), "new name");
this.addArg(ARFaction.get(), "faction", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.NAME.node));
@ -39,9 +40,8 @@ public class CmdFactionsName extends FactionsCommand
public void perform() throws MassiveException
{
// Args
String newName = this.arg(0);
Faction faction = this.arg(1, ARFaction.get(), msenderFaction);
String newName = this.readArg();
Faction faction = this.readArg(msenderFaction);
// MPerm
if ( ! MPerm.getPermName().has(msender, faction, true)) return;

View File

@ -22,7 +22,7 @@ public class CmdFactionsPermList extends FactionsCommand
this.addAliases("l", "list");
// Args
this.addOptionalArg("page", "1");
this.addArg(ARInteger.get(), "page", "1");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.PERM_LIST.node));
@ -36,7 +36,7 @@ public class CmdFactionsPermList extends FactionsCommand
public void perform() throws MassiveException
{
// Args
Integer pageHumanBased = this.arg(0, ARInteger.get(), 1);
int pageHumanBased = this.readArg(1);
// Create messages
List<String> messages = new ArrayList<String>();

View File

@ -28,10 +28,10 @@ public class CmdFactionsPermSet extends FactionsCommand
this.addAliases("set");
// Args
this.addRequiredArg("perm");
this.addRequiredArg("relation");
this.addRequiredArg("yes/no");
this.addOptionalArg("faction", "you");
this.addArg(ARMPerm.get(), "perm");
this.addArg(ARRel.get(), "relation");
this.addArg(ARBoolean.get(), "yes/no");
this.addArg(ARFaction.get(), "faction", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.PERM_SET.node));
@ -45,10 +45,10 @@ public class CmdFactionsPermSet extends FactionsCommand
public void perform() throws MassiveException
{
// Args
MPerm perm = this.arg(0, ARMPerm.get());
Rel rel = this.arg(1, ARRel.get());
Boolean value = this.arg(2, ARBoolean.get());
Faction faction = this.arg(3, ARFaction.get(), msenderFaction);
MPerm perm = this.readArg();
Rel rel = this.readArg();
Boolean value = this.readArg();
Faction faction = this.readArg(msenderFaction);
// Do the sender have the right to change perms for this faction?
if ( ! MPerm.getPermPerms().has(msender, faction, true)) return;

View File

@ -9,7 +9,8 @@ import com.massivecraft.factions.cmd.arg.ARMPerm;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.arg.ARList;
import com.massivecraft.massivecore.cmd.arg.ARAll;
import com.massivecraft.massivecore.cmd.arg.ARSet;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
@ -25,9 +26,8 @@ public class CmdFactionsPermShow extends FactionsCommand
this.addAliases("s", "show");
// Args
this.addOptionalArg("faction", "you");
this.addOptionalArg("perms", "all");
this.setErrorOnToManyArgs(false);
this.addArg(ARFaction.get(), "faction", "you");
this.addArg(ARAll.get(ARSet.get(ARMPerm.get(), false)), "perms", "all", true);
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.PERM_SHOW.node));
@ -41,33 +41,15 @@ public class CmdFactionsPermShow extends FactionsCommand
public void perform() throws MassiveException
{
// Arg: Faction
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
List<MPerm> perms = new ArrayList<MPerm>();
// Case: Show All
if ( ! this.argIsSet(1) || "all".equalsIgnoreCase(this.arg(1)))
{
for (MPerm mperm : MPerm.getAll())
{
if ( ! mperm.isVisible() && ! msender.isUsingAdminMode()) continue;
perms.add(mperm);
}
}
// Case: Show Some
else
{
// Arg perm. Maybe we should use ARSet but that is currently buggy.
List<MPerm> mperms = this.arg(this.argConcatFrom(1), ARList.get(ARMPerm.get()));
perms.addAll(mperms);
}
Faction faction = this.readArg(msenderFaction);
List<MPerm> mperms = this.readArg(MPerm.getAll());
// Create messages
List<String> messages = new ArrayList<String>();
messages.add(Txt.titleize("Perm for " + faction.describeTo(msender, true)));
messages.add(MPerm.getStateHeaders());
for (MPerm mperm : perms)
for (MPerm mperm : mperms)
{
messages.add(Txt.parse(mperm.getStateInfo(faction.getPermitted(mperm), true)));
}

View File

@ -27,7 +27,7 @@ public class CmdFactionsPlayer extends FactionsCommand
this.addAliases("p", "player");
// Args
this.addOptionalArg("player", "you");
this.addArg(ARMPlayer.getAny(), "player", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.PLAYER.node));
@ -41,7 +41,7 @@ public class CmdFactionsPlayer extends FactionsCommand
public void perform() throws MassiveException
{
// Args
MPlayer mplayer = this.arg(0, ARMPlayer.getAny(), msender);
MPlayer mplayer = this.readArg(msender);
// INFO: Title
msg(Txt.titleize("Player " + mplayer.describeTo(msender)));

View File

@ -7,11 +7,19 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.ArgSetting;
import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.massivecore.cmd.arg.ARString;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsPowerBoost extends FactionsCommand
{
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private ArgSetting setting = ArgSetting.of(ARMPlayer.getAny(), false, "name", null);
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
@ -22,9 +30,9 @@ public class CmdFactionsPowerBoost extends FactionsCommand
this.addAliases("powerboost");
// Args
this.addRequiredArg("p|f|player|faction");
this.addRequiredArg("name");
this.addRequiredArg("#");
this.addArg(ARString.get(), "p|f|player|faction");
this.addArg(setting);
this.addArg(ARDouble.get(), "#");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.POWERBOOST.node));
@ -37,7 +45,7 @@ public class CmdFactionsPowerBoost extends FactionsCommand
@Override
public void perform() throws MassiveException
{
String type = this.arg(0).toLowerCase();
String type = this.<String>readArg().toLowerCase();
boolean doPlayer = true;
if (type.equals("f") || type.equals("faction"))
{
@ -50,20 +58,22 @@ public class CmdFactionsPowerBoost extends FactionsCommand
return;
}
Double targetPower = this.arg(2, ARDouble.get());
double targetPower = this.readArgAt(2);
String target;
if (doPlayer)
{
MPlayer targetPlayer = this.arg(1, ARMPlayer.getAny());
setting.setReader(ARMPlayer.getAny());
MPlayer targetPlayer = this.readArgAt(1);
targetPlayer.setPowerBoost(targetPower);
target = "Player \""+targetPlayer.getName()+"\"";
}
else
{
Faction targetFaction = this.arg(1, ARFaction.get());
setting.setReader(ARFaction.get());
Faction targetFaction = this.readArgAt(1);
targetFaction.setPowerBoost(targetPower);
target = "Faction \""+targetFaction.getName()+"\"";

View File

@ -48,6 +48,9 @@ public class CmdFactionsRank extends FactionsCommand
private Rel targetRank = null;
private Rel rank = null;
// This one is permanent
private ARRank rankReader = new ARRank();
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
@ -58,9 +61,9 @@ public class CmdFactionsRank extends FactionsCommand
this.addAliases("rank");
// Args
this.addRequiredArg("player");
this.addOptionalArg("action", "show");
this.addOptionalArg("faction", "their");
this.addArg(ARMPlayer.getAny(), "player");
this.addArg(rankReader, "action", "show");
this.addArg(ARFaction.get(), "faction", "their");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.RANK.node));
@ -123,22 +126,25 @@ public class CmdFactionsRank extends FactionsCommand
private void registerFields() throws MassiveException
{
// Getting the target and faction.
target = this.arg(0, ARMPlayer.getAny(), msender);
target = this.readArg(msender);
targetFaction = target.getFaction();
// Rank if any passed.
if (this.argIsSet(1))
{
rank = this.arg(1, ARRank.get(target.getRole()));
}
// Changing peoples faction.
endFaction = this.arg(2, ARFaction.get(), targetFaction);
factionChange = (endFaction != targetFaction);
// Ranks
senderRank = msender.getRole();
targetRank = target.getRole();
// Rank if any passed.
if (this.argIsSet(1))
{
this.rankReader.setStartRank(targetRank);
rank = this.readArg();
}
// Changing peoples faction.
endFaction = this.readArgAt(2, targetFaction);
factionChange = (endFaction != targetFaction);
}
private void unregisterFields()

View File

@ -1,6 +1,8 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.massivecore.cmd.VisibilityMode;
import com.massivecraft.massivecore.util.MUtil;
@ -25,8 +27,8 @@ public class CmdFactionsRankOld extends FactionsCommand
this.addAliases(rankName);
// Args
this.addRequiredArg("player");
this.addOptionalArg("faction", "their");
this.addArg(ARMPlayer.getAny(), "player");
this.addArg(ARFaction.get(), "faction", "their");
// VisibilityMode
this.setVisibilityMode(VisibilityMode.INVISIBLE);
@ -39,7 +41,7 @@ public class CmdFactionsRankOld extends FactionsCommand
@Override
public void perform()
{
Factions.get().getOuterCmdFactions().cmdFactionsRank.execute(sender, MUtil.list(this.arg(0), this.rankName, this.arg(1)));
Factions.get().getOuterCmdFactions().cmdFactionsRank.execute(sender, MUtil.list(this.argAt(0), this.rankName, this.argAt(1)));
}
}

View File

@ -23,7 +23,7 @@ public abstract class CmdFactionsRelationAbstract extends FactionsCommand
public CmdFactionsRelationAbstract()
{
// Aliases
this.addRequiredArg("faction");
this.addArg(ARFaction.get(), "faction");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.RELATION.node));
@ -38,7 +38,7 @@ public abstract class CmdFactionsRelationAbstract extends FactionsCommand
public void perform() throws MassiveException
{
// Args
Faction otherFaction = this.arg(0, ARFaction.get());
Faction otherFaction = this.readArg();
Rel newRelation = targetRelation;

View File

@ -19,7 +19,7 @@ public class CmdFactionsSeeChunk extends FactionsCommand
this.addAliases("sc", "seechunk");
// Args
this.addOptionalArg("active", "toggle");
this.addArg(ARBoolean.get(), "active", "toggle");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.SEECHUNK.node));
@ -36,11 +36,11 @@ public class CmdFactionsSeeChunk extends FactionsCommand
// Args
boolean old = msender.isSeeingChunk();
boolean targetDefault = !old;
Boolean target = this.arg(0, ARBoolean.get(), targetDefault);
boolean target = this.readArg(targetDefault);
String targetDesc = Txt.parse(target ? "<g>ON": "<b>OFF");
// NoChange
if (target.equals(old))
if (target == old)
{
msg("<i>See Chunk is already %s<i>.", targetDesc);
return;

View File

@ -1,5 +1,7 @@
package com.massivecraft.factions.cmd;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import com.massivecraft.factions.Perm;
@ -7,9 +9,7 @@ import com.massivecraft.factions.entity.Board;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.arg.ARWorldId;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.MUtil;
@ -17,6 +17,13 @@ import com.massivecraft.massivecore.util.MUtil;
public class CmdFactionsSetAll extends CmdFactionsSetXAll
{
// -------------------------------------------- //
// CONSTANTS
// -------------------------------------------- //
public static final List<String> LIST_ALL = Collections.unmodifiableList(MUtil.list("a", "al", "all"));
public static final List<String> LIST_MAP = Collections.singletonList("map");
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
@ -30,7 +37,6 @@ public class CmdFactionsSetAll extends CmdFactionsSetXAll
this.addAliases("all");
// Requirements
this.addRequirements(ReqIsPlayer.get());
String node = claim ? Perm.CLAIM_ALL.node : Perm.UNCLAIM_ALL.node;
this.addRequirements(ReqHasPerm.get(node));
}
@ -52,7 +58,7 @@ public class CmdFactionsSetAll extends CmdFactionsSetXAll
Faction oldFaction = this.getOldFaction();
if (oldFaction == null) return null;
if (MUtil.list("a", "al", "all").contains(this.arg(0).toLowerCase()))
if (LIST_ALL.contains(this.argAt(0).toLowerCase()))
{
chunks = BoardColl.get().getChunks(oldFaction);
this.setFormatOne("<h>%s<i> %s <h>%d <i>chunk using " + word + " all.");
@ -61,7 +67,7 @@ public class CmdFactionsSetAll extends CmdFactionsSetXAll
else
{
String worldId = null;
if (MUtil.list("map").contains(this.arg(0).toLowerCase()))
if (LIST_MAP.contains(this.argAt(0).toLowerCase()))
{
if (me != null)
{
@ -75,7 +81,7 @@ public class CmdFactionsSetAll extends CmdFactionsSetXAll
}
else
{
worldId = this.arg(0, ARWorldId.get());
worldId = this.argAt(0);
if (worldId == null) return null;
}
Board board = BoardColl.get().get(worldId);

View File

@ -39,7 +39,7 @@ public class CmdFactionsSetAuto extends FactionsCommand
// Args
if (claim)
{
this.addOptionalArg("faction", "you");
this.addArg(ARFaction.get(), "faction", "you");
}
// Requirements
@ -59,7 +59,7 @@ public class CmdFactionsSetAuto extends FactionsCommand
final Faction newFaction;
if (claim)
{
newFaction = this.arg(0, ARFaction.get(), msenderFaction);
newFaction = this.readArg(msenderFaction);
}
else
{

View File

@ -2,13 +2,11 @@ package com.massivecraft.factions.cmd;
import java.util.Set;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.ps.PS;
public abstract class CmdFactionsSetX extends FactionsCommand
{
// -------------------------------------------- //
@ -69,7 +67,7 @@ public abstract class CmdFactionsSetX extends FactionsCommand
{
if (this.isClaim())
{
return this.arg(this.getFactionArgIndex(), ARFaction.get(), msenderFaction);
return this.readArgAt(this.getFactionArgIndex(), msenderFaction);
}
else
{

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.arg.ARString;
public abstract class CmdFactionsSetXAll extends CmdFactionsSetX
{
@ -16,11 +17,11 @@ public abstract class CmdFactionsSetXAll extends CmdFactionsSetX
super(claim);
// Args
this.addRequiredArg("all|map");
this.addRequiredArg("faction");
this.addArg(ARString.get(), "all|map");
this.addArg(ARFaction.get(), "faction");
if (claim)
{
this.addRequiredArg("newfaction");
this.addArg(ARFaction.get(), "newfaction");
this.setFactionArgIndex(2);
}
}
@ -31,7 +32,7 @@ public abstract class CmdFactionsSetXAll extends CmdFactionsSetX
public Faction getOldFaction() throws MassiveException
{
return this.arg(1, ARFaction.get());
return this.readArgAt(1);
}
}

View File

@ -1,5 +1,6 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.arg.ARInteger;
@ -17,10 +18,10 @@ public abstract class CmdFactionsSetXRadius extends CmdFactionsSetX
super(claim);
// Args
this.addOptionalArg("radius", "1");
this.addArg(ARInteger.get(), "radius", "1");
if (claim)
{
this.addOptionalArg("faction", "you");
this.addArg(ARFaction.get(), "faction", "you");
this.setFactionArgIndex(1);
}
}
@ -31,8 +32,7 @@ public abstract class CmdFactionsSetXRadius extends CmdFactionsSetX
public Integer getRadius() throws MassiveException
{
Integer radius = this.arg(0, ARInteger.get(), 1);
if (radius == null) return radius;
int radius = this.readArg(1);
// Radius Claim Min
if (radius < 1)

View File

@ -1,5 +1,7 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.cmd.arg.ARFaction;
public abstract class CmdFactionsSetXSimple extends CmdFactionsSetX
{
// -------------------------------------------- //
@ -14,7 +16,7 @@ public abstract class CmdFactionsSetXSimple extends CmdFactionsSetX
// Args
if (claim)
{
this.addOptionalArg("faction", "you");
this.addArg(ARFaction.get(), "faction", "you");
this.setFactionArgIndex(0);
}
}

View File

@ -23,7 +23,7 @@ public class CmdFactionsSethome extends FactionsCommandHome
this.addAliases("sethome");
// Args
this.addOptionalArg("faction", "you");
this.addArg(ARFaction.get(), "faction", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.SETHOME.node));
@ -38,7 +38,7 @@ public class CmdFactionsSethome extends FactionsCommandHome
public void perform() throws MassiveException
{
// Args
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
Faction faction = this.readArg(msenderFaction);
PS newHome = PS.valueOf(me.getLocation());

View File

@ -21,8 +21,8 @@ public class CmdFactionsSetpower extends FactionsCommand
this.addAliases("sp", "setpower");
// Args
this.addRequiredArg("player");
this.addRequiredArg("power");
this.addArg(ARMPlayer.getAny(), "player");
this.addArg(ARDouble.get(), "power");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.SETPOWER.node));
@ -36,8 +36,8 @@ public class CmdFactionsSetpower extends FactionsCommand
public void perform() throws MassiveException
{
// Args
MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
Double power = this.arg(1, ARDouble.get());
MPlayer mplayer = this.readArg();
double power = this.readArg();
// Power
double oldPower = mplayer.getPower();
@ -48,7 +48,7 @@ public class CmdFactionsSetpower extends FactionsCommand
double maxDifference = 0.1d;
if (difference < maxDifference)
{
msender.msg("%s's <i>power is already <h>%.2f<i>.", mplayer.getDisplayName(msender), newPower);
msg("%s's <i>power is already <h>%.2f<i>.", mplayer.getDisplayName(msender), newPower);
return;
}
@ -58,7 +58,7 @@ public class CmdFactionsSetpower extends FactionsCommand
if (event.isCancelled()) return;
// Inform
msender.msg("<i>You changed %s's <i>power from <h>%.2f <i>to <h>%.2f<i>.", mplayer.getDisplayName(msender), oldPower, newPower);
msg("<i>You changed %s's <i>power from <h>%.2f <i>to <h>%.2f<i>.", mplayer.getDisplayName(msender), oldPower, newPower);
if (msender != mplayer)
{
mplayer.msg("%s <i>changed your power from <h>%.2f <i>to <h>%.2f<i>.", msender.getDisplayName(mplayer), oldPower, newPower);

View File

@ -34,9 +34,9 @@ public class CmdFactionsStatus extends FactionsCommand
this.addAliases("s", "status");
// Args
this.addOptionalArg("page", "1");
this.addOptionalArg("faction", "you");
this.addOptionalArg("sort by", "time");
this.addArg(ARInteger.get(), "page", "1");
this.addArg(ARFaction.get(), "faction", "you");
this.addArg(ARSortMPlayer.get(), "sort by", "time");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.STATUS.node));
@ -50,9 +50,9 @@ public class CmdFactionsStatus extends FactionsCommand
public void perform() throws MassiveException
{
// Args
Integer pageHumanBased = this.arg(0, ARInteger.get(), 1);
Faction faction = this.arg(1, ARFaction.get(), msenderFaction);
Comparator<MPlayer> sortedBy = this.arg(2, ARSortMPlayer.get(), PlayerInactivityComparator.get());
Integer pageHumanBased = this.readArg(1);
Faction faction = this.readArg(msenderFaction);
Comparator<MPlayer> sortedBy = this.readArg(PlayerInactivityComparator.get());
// MPerm
if ( ! MPerm.getPermStatus().has(msender, faction, true)) return;

View File

@ -24,8 +24,8 @@ public class CmdFactionsTitle extends FactionsCommand
this.addAliases("title");
// Args
this.addRequiredArg("player");
this.addOptionalArg("title", "");
this.addArg(ARMPlayer.getAny(), "player");
this.addArg(ARString.get(), "title", "", true);
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.TITLE.node));
@ -39,8 +39,8 @@ public class CmdFactionsTitle extends FactionsCommand
public void perform() throws MassiveException
{
// Args
MPlayer you = this.arg(0, ARMPlayer.getAny());
String newTitle = this.argConcatFrom(1, ARString.get(), "");
MPlayer you = this.readArg();
String newTitle = this.readArg("");
newTitle = Txt.parse(newTitle);
if (!Perm.TITLE_COLOR.has(sender, false))

View File

@ -20,7 +20,7 @@ public class CmdFactionsUnsethome extends FactionsCommandHome
this.addAliases("unsethome");
// Args
this.addOptionalArg("faction", "you");
this.addArg(ARFaction.get(), "faction", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.UNSETHOME.node));
@ -34,7 +34,7 @@ public class CmdFactionsUnsethome extends FactionsCommandHome
public void perform() throws MassiveException
{
// Args
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
Faction faction = this.readArg(msenderFaction);
// Any and MPerm
if ( ! MPerm.getPermSethome().has(msender, faction, true)) return;

View File

@ -24,7 +24,7 @@ public class CmdFactionsXPlaceholder extends FactionsCommand
this.setDesc("Use " + extensionName);
// Args
this.setErrorOnToManyArgs(false);
this.setGivingErrorOnTooManyArgs(false);
}
// -------------------------------------------- //

View File

@ -1,17 +1,19 @@
package com.massivecraft.factions.cmd.arg;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.CaseInsensitiveComparator;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.cmd.arg.ARAbstract;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.util.IdUtil;
public class ARFaction extends ARAbstract<Faction>
@ -63,11 +65,11 @@ public class ARFaction extends ARAbstract<Faction>
@Override
public Collection<String> getTabList(CommandSender sender, String arg)
{
List<String> ret = new MassiveList<String>();
Set<String> ret = new TreeSet<String>(CaseInsensitiveComparator.get());
for (Faction faction : FactionColl.get().getAll())
{
ret.add(faction.getName());
ret.add(ChatColor.stripColor(faction.getName()));
}
return ret;

View File

@ -8,9 +8,10 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.factions.entity.MFlag;
import com.massivecraft.massivecore.cmd.arg.ARAbstractSelect;
import com.massivecraft.massivecore.cmd.arg.ARAllAble;
import com.massivecraft.massivecore.util.Txt;
public class ARMFlag extends ARAbstractSelect<MFlag>
public class ARMFlag extends ARAbstractSelect<MFlag> implements ARAllAble<MFlag>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
@ -77,6 +78,12 @@ public class ARMFlag extends ARAbstractSelect<MFlag>
return this.altNames(sender);
}
@Override
public Collection<MFlag> getAll(CommandSender sender)
{
return MFlag.getAll();
}
// -------------------------------------------- //
// UTIL
// -------------------------------------------- //

View File

@ -8,9 +8,10 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.massivecore.cmd.arg.ARAbstractSelect;
import com.massivecraft.massivecore.cmd.arg.ARAllAble;
import com.massivecraft.massivecore.util.Txt;
public class ARMPerm extends ARAbstractSelect<MPerm>
public class ARMPerm extends ARAbstractSelect<MPerm> implements ARAllAble<MPerm>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
@ -77,6 +78,12 @@ public class ARMPerm extends ARAbstractSelect<MPerm>
return this.altNames(sender);
}
@Override
public Collection<MPerm> getAll(CommandSender sender)
{
return MPerm.getAll();
}
// -------------------------------------------- //
// UTIL
// -------------------------------------------- //

View File

@ -54,8 +54,9 @@ public class ARRank extends ARAbstractSelect<Rel>
// FIELDS
// -------------------------------------------- //
private final Rel startRank;
private Rel startRank;
public Rel getStartRank() { return this.startRank; }
public void setStartRank(Rel startRank) { this.startRank = startRank; }
// -------------------------------------------- //
// OVERRIDE