MassiveCore Change - ArgReaders use Exceptions
This commit is contained in:
parent
8c27fe6505
commit
8322528652
@ -8,6 +8,7 @@ import com.massivecraft.factions.RelationParticipator;
|
||||
import com.massivecraft.factions.TerritoryAccess;
|
||||
import com.massivecraft.factions.entity.BoardColl;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
|
||||
@ -39,7 +40,7 @@ public abstract class CmdFactionsAccessAbstract extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
chunk = PS.valueOf(me.getLocation()).getChunk(true);
|
||||
ta = BoardColl.get().getTerritoryAccessAt(chunk);
|
||||
@ -48,7 +49,7 @@ public abstract class CmdFactionsAccessAbstract extends FactionsCommand
|
||||
this.innerPerform();
|
||||
}
|
||||
|
||||
public abstract void innerPerform();
|
||||
public abstract void innerPerform() throws MassiveCommandException;
|
||||
|
||||
public void sendAccessInfo()
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.BoardColl;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -32,14 +33,11 @@ public class CmdFactionsAccessFaction extends CmdFactionsAccessAbstract
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void innerPerform()
|
||||
public void innerPerform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
Faction faction = this.arg(0, ARFaction.get());
|
||||
if (faction == null) return;
|
||||
|
||||
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isFactionIdGranted(faction.getId()));
|
||||
if (newValue == null) return;
|
||||
|
||||
// MPerm
|
||||
if (!MPerm.getPermAccess().has(msender, hostFaction, true)) return;
|
||||
|
@ -5,6 +5,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||
import com.massivecraft.factions.entity.BoardColl;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -32,14 +33,11 @@ public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void innerPerform()
|
||||
public void innerPerform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
|
||||
if (mplayer == null) return;
|
||||
|
||||
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isPlayerIdGranted(mplayer.getId()));
|
||||
if (newValue == null) return;
|
||||
|
||||
// MPerm
|
||||
if (!MPerm.getPermAccess().has(msender, hostFaction, true)) return;
|
||||
|
@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
@ -30,11 +31,10 @@ public class CmdFactionsAdmin extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
Boolean target = this.arg(0, ARBoolean.get(), !msender.isUsingAdminMode());
|
||||
if (target == null) return;
|
||||
|
||||
// Apply
|
||||
msender.setUsingAdminMode(target);
|
||||
|
@ -12,6 +12,7 @@ import com.massivecraft.factions.event.EventFactionsMembershipChange;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -39,11 +40,10 @@ public class CmdFactionsDisband extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
// MPerm
|
||||
if ( ! MPerm.getPermDisband().has(msender, faction, true)) return;
|
||||
|
@ -11,6 +11,7 @@ import com.massivecraft.factions.event.EventFactionsFactionShowAsync;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.massivecore.PriorityLines;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.mixin.Mixin;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -38,11 +39,10 @@ public class CmdFactionsFaction extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
final Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
final CommandSender sender = this.sender;
|
||||
|
||||
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.entity.MFlag;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARInteger;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -32,11 +33,10 @@ public class CmdFactionsFlagList extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
Integer pageHumanBased = this.arg(0, ARInteger.get(), 1);
|
||||
if (pageHumanBased == null) return;
|
||||
|
||||
//Create messages
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
@ -7,6 +7,7 @@ import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MFlag;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.event.EventFactionsFlagChange;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -35,15 +36,12 @@ public class CmdFactionsFlagSet extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
MFlag flag = this.arg(0, ARMFlag.get());
|
||||
if (flag == null) return;
|
||||
Boolean value = this.arg(1, ARBoolean.get());
|
||||
if (value == null) return;
|
||||
Faction faction = this.arg(2, ARFaction.get(), msenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
// Do the sender have the right to change flags for this faction?
|
||||
if ( ! MPerm.getPermFlags().has(msender, faction, true)) return;
|
||||
|
@ -8,6 +8,7 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.arg.ARMFlag;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MFlag;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARList;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -37,11 +38,10 @@ public class CmdFactionsFlagShow extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Arg: Faction
|
||||
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
List<MFlag> flags = new ArrayList<MFlag>();
|
||||
|
||||
@ -58,7 +58,6 @@ public class CmdFactionsFlagShow extends FactionsCommand
|
||||
{
|
||||
// Arg: MFlag. Maybe we should use ARSet but that is currently buggy.
|
||||
List<MFlag> mflags = this.arg(this.argConcatFrom(1), ARList.get(ARMFlag.get()));
|
||||
if (mflags == null) return;
|
||||
flags.addAll(mflags);
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@ import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.event.EventFactionsHomeTeleport;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
import com.massivecraft.massivecore.mixin.Mixin;
|
||||
@ -46,7 +47,7 @@ public class CmdFactionsHome extends FactionsCommandHome
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
if ( ! MConf.get().homesTeleportCommandEnabled)
|
||||
{
|
||||
@ -56,7 +57,6 @@ public class CmdFactionsHome extends FactionsCommandHome
|
||||
|
||||
// Args
|
||||
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
|
||||
if (faction == null) return;
|
||||
PS home = faction.getHome();
|
||||
String homeDesc = "home for " + faction.describeTo(msender, false);
|
||||
|
||||
|
@ -8,6 +8,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.event.EventFactionsInvitedChange;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARSet;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -34,11 +35,10 @@ public class CmdFactionsInviteAdd extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
Set<MPlayer> mplayers = this.argConcatFrom(0, ARSet.get(ARMPlayer.getAny(), true));
|
||||
if (mplayers == null) return;
|
||||
|
||||
// MPerm
|
||||
if ( ! MPerm.getPermInvite().has(msender, msenderFaction, true)) return;
|
||||
|
@ -8,6 +8,7 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARInteger;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.pager.PagerSimple;
|
||||
@ -38,14 +39,12 @@ public class CmdFactionsInviteList extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
Integer pageHumanBased = this.arg(0, ARInteger.get(), 1);
|
||||
if (pageHumanBased == null) return;
|
||||
|
||||
Faction faction = this.arg(1, ARFaction.get(), msenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
if ( faction != msenderFaction && ! Perm.INVITE_LIST_OTHER.has(sender, true)) return;
|
||||
|
||||
|
@ -10,6 +10,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.event.EventFactionsInvitedChange;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARSet;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
@ -37,7 +38,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
Set<MPlayer> mplayers = new HashSet<MPlayer>();
|
||||
boolean all = false;
|
||||
@ -58,7 +59,6 @@ public class CmdFactionsInviteRemove extends FactionsCommand
|
||||
else
|
||||
{
|
||||
Set<MPlayer> senderInput = this.argConcatFrom(0, ARSet.get(ARMPlayer.getAny(), true));
|
||||
if (senderInput == null) return;
|
||||
|
||||
mplayers.addAll(senderInput);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
@ -37,14 +38,12 @@ public class CmdFactionsJoin extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
Faction faction = this.arg(0, ARFaction.get());
|
||||
if (faction == null) return;
|
||||
|
||||
MPlayer mplayer = this.arg(1, ARMPlayer.getAny(), msender);
|
||||
if (mplayer == null) return;
|
||||
Faction mplayerFaction = mplayer.getFaction();
|
||||
|
||||
boolean samePlayer = mplayer == msender;
|
||||
|
@ -11,6 +11,7 @@ import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
|
||||
@ -37,11 +38,10 @@ public class CmdFactionsKick extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Arg
|
||||
MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
|
||||
if (mplayer == null) return;
|
||||
|
||||
// Validate
|
||||
if (msender == mplayer)
|
||||
|
@ -10,6 +10,7 @@ import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARInteger;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.mixin.Mixin;
|
||||
@ -40,11 +41,10 @@ public class CmdFactionsList extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
final Integer pageHumanBased = this.arg(0, ARInteger.get(), 1);
|
||||
if (pageHumanBased == null) return;
|
||||
|
||||
// NOTE: The faction list is quite slow and mostly thread safe.
|
||||
// We run it asynchronously to spare the primary server thread.
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.Location;
|
||||
import com.massivecraft.factions.Const;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.entity.BoardColl;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
@ -36,7 +37,7 @@ public class CmdFactionsMap extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
if ( ! this.argIsSet(0))
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdFactionsMoneyBalance extends FactionsCommand
|
||||
@ -31,10 +32,9 @@ public class CmdFactionsMoneyBalance extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
if (faction != msenderFaction && ! Perm.MONEY_BALANCE_ANY.has(sender, true)) return;
|
||||
|
||||
|
@ -7,6 +7,7 @@ import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARDouble;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
@ -39,13 +40,11 @@ public class CmdFactionsMoneyDeposit extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
Double amount = this.arg(0, ARDouble.get());
|
||||
if (amount == null) return;
|
||||
|
||||
Faction faction = this.arg(1, ARFaction.get(), msenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
boolean success = Econ.transferMoney(msender, msender, faction, amount);
|
||||
|
||||
|
@ -7,6 +7,7 @@ import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARDouble;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
@ -41,16 +42,11 @@ public class CmdFactionsMoneyTransferFf extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
Double amount = this.arg(0, ARDouble.get());
|
||||
if (amount == null) return;
|
||||
|
||||
Faction from = this.arg(1, ARFaction.get());
|
||||
if (from == null) return;
|
||||
|
||||
Faction to = this.arg(2, ARFaction.get());
|
||||
if (to == null) return;
|
||||
|
||||
boolean success = Econ.transferMoney(msender, from, to, amount);
|
||||
|
||||
|
@ -9,6 +9,7 @@ import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARDouble;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
@ -43,16 +44,11 @@ public class CmdFactionsMoneyTransferFp extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
Double amount = this.arg(0, ARDouble.get());
|
||||
if (amount == null) return;
|
||||
|
||||
Faction from = this.arg(1, ARFaction.get());
|
||||
if (from == null) return;
|
||||
|
||||
MPlayer to = this.arg(2, ARMPlayer.getAny());
|
||||
if (to == null) return;
|
||||
|
||||
boolean success = Econ.transferMoney(msender, from, to, amount);
|
||||
|
||||
|
@ -9,6 +9,7 @@ import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARDouble;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
@ -43,16 +44,11 @@ public class CmdFactionsMoneyTransferPf extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
Double amount = this.arg(0, ARDouble.get());
|
||||
if (amount == null) return;
|
||||
|
||||
MPlayer from = this.arg(1, ARMPlayer.getAny());
|
||||
if (from == null) return;
|
||||
|
||||
Faction to = this.arg(2, ARFaction.get());
|
||||
if (to == null) return;
|
||||
|
||||
boolean success = Econ.transferMoney(msender, from, to, amount);
|
||||
|
||||
|
@ -8,6 +8,7 @@ import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARDouble;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.money.Money;
|
||||
@ -41,13 +42,10 @@ public class CmdFactionsMoneyWithdraw extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
Double amount = this.arg(0, ARDouble.get());
|
||||
if (amount == null) return;
|
||||
|
||||
Faction from = this.arg(1, ARFaction.get(), msenderFaction);
|
||||
if (from == null) return;
|
||||
|
||||
MPlayer to = msender;
|
||||
|
||||
|
@ -9,6 +9,7 @@ import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.event.EventFactionsNameChange;
|
||||
import com.massivecraft.factions.util.MiscUtil;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdFactionsName extends FactionsCommand
|
||||
@ -35,13 +36,12 @@ public class CmdFactionsName extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
String newName = this.arg(0);
|
||||
|
||||
Faction faction = this.arg(1, ARFaction.get(), msenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
// MPerm
|
||||
if ( ! MPerm.getPermName().has(msender, faction, true)) return;
|
||||
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARInteger;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -32,11 +33,10 @@ public class CmdFactionsPermList extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
Integer pageHumanBased = this.arg(0, ARInteger.get(), 1);
|
||||
if (pageHumanBased == null) return;
|
||||
|
||||
// Create messages
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
@ -11,6 +11,7 @@ import com.massivecraft.factions.cmd.arg.ARRel;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -41,17 +42,13 @@ public class CmdFactionsPermSet extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
MPerm perm = this.arg(0, ARMPerm.get());
|
||||
if (perm == null) return;
|
||||
Rel rel = this.arg(1, ARRel.get());
|
||||
if (rel == null) return;
|
||||
Boolean value = this.arg(2, ARBoolean.get());
|
||||
if (value == null) return;
|
||||
Faction faction = this.arg(3, ARFaction.get(), msenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
// Do the sender have the right to change perms for this faction?
|
||||
if ( ! MPerm.getPermPerms().has(msender, faction, true)) return;
|
||||
|
@ -8,6 +8,7 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.arg.ARMPerm;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARList;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -37,11 +38,10 @@ public class CmdFactionsPermShow extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Arg: Faction
|
||||
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
List<MPerm> perms = new ArrayList<MPerm>();
|
||||
|
||||
@ -59,7 +59,6 @@ public class CmdFactionsPermShow extends FactionsCommand
|
||||
{
|
||||
// Arg perm. Maybe we should use ARSet but that is currently buggy.
|
||||
List<MPerm> mperms = this.arg(this.argConcatFrom(1), ARList.get(ARMPerm.get()));
|
||||
if (mperms == null) return;
|
||||
perms.addAll(mperms);
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.event.EventFactionsRemovePlayerMillis;
|
||||
import com.massivecraft.massivecore.Progressbar;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.TimeDiffUtil;
|
||||
import com.massivecraft.massivecore.util.TimeUnit;
|
||||
@ -37,11 +38,10 @@ public class CmdFactionsPlayer extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
MPlayer mplayer = this.arg(0, ARMPlayer.getAny(), msender);
|
||||
if (mplayer == null) return;
|
||||
|
||||
// INFO: Title
|
||||
msg(Txt.titleize("Player " + mplayer.describeTo(msender)));
|
||||
|
@ -6,6 +6,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARDouble;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -34,7 +35,7 @@ public class CmdFactionsPowerBoost extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
String type = this.arg(0).toLowerCase();
|
||||
boolean doPlayer = true;
|
||||
@ -50,14 +51,12 @@ public class CmdFactionsPowerBoost extends FactionsCommand
|
||||
}
|
||||
|
||||
Double targetPower = this.arg(2, ARDouble.get());
|
||||
if (targetPower == null) return;
|
||||
|
||||
String target;
|
||||
|
||||
if (doPlayer)
|
||||
{
|
||||
MPlayer targetPlayer = this.arg(1, ARMPlayer.getAny());
|
||||
if (targetPlayer == null) return;
|
||||
|
||||
targetPlayer.setPowerBoost(targetPower);
|
||||
target = "Player \""+targetPlayer.getName()+"\"";
|
||||
@ -65,7 +64,6 @@ public class CmdFactionsPowerBoost extends FactionsCommand
|
||||
else
|
||||
{
|
||||
Faction targetFaction = this.arg(1, ARFaction.get());
|
||||
if (targetFaction == null) return;
|
||||
|
||||
targetFaction.setPowerBoost(targetPower);
|
||||
target = "Faction \""+targetFaction.getName()+"\"";
|
||||
|
@ -13,6 +13,7 @@ import com.massivecraft.factions.entity.MFlag;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayerColl;
|
||||
import com.massivecraft.factions.event.EventFactionsRankChange;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
@ -63,7 +64,7 @@ public class CmdFactionsRank extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// This sets target and much other. Returns false if not succeeded.
|
||||
if ( ! this.registerFields())
|
||||
@ -121,7 +122,7 @@ public class CmdFactionsRank extends FactionsCommand
|
||||
// PRIVATE
|
||||
// -------------------------------------------- //
|
||||
|
||||
private boolean registerFields()
|
||||
private boolean registerFields() throws MassiveCommandException
|
||||
{
|
||||
// Getting the target and faction.
|
||||
target = this.arg(0, ARMPlayer.getAny(), msender);
|
||||
|
@ -9,6 +9,7 @@ import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.entity.MFlag;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.event.EventFactionsRelationChange;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
public abstract class CmdFactionsRelationAbstract extends FactionsCommand
|
||||
@ -34,11 +35,10 @@ public abstract class CmdFactionsRelationAbstract extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
Faction otherFaction = this.arg(0, ARFaction.get());
|
||||
if (otherFaction == null) return;
|
||||
|
||||
Rel newRelation = targetRelation;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
@ -30,13 +31,12 @@ public class CmdFactionsSeeChunk extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
boolean old = msender.isSeeingChunk();
|
||||
boolean targetDefault = !old;
|
||||
Boolean target = this.arg(0, ARBoolean.get(), targetDefault);
|
||||
if (target == null) return;
|
||||
String targetDesc = Txt.parse(target ? "<g>ON": "<b>OFF");
|
||||
|
||||
// NoChange
|
||||
|
@ -6,6 +6,7 @@ import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.entity.Board;
|
||||
import com.massivecraft.factions.entity.BoardColl;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARWorldId;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
@ -39,7 +40,7 @@ public class CmdFactionsSetAll extends CmdFactionsSetXAll
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public Set<PS> getChunks()
|
||||
public Set<PS> getChunks() throws MassiveCommandException
|
||||
{
|
||||
// World
|
||||
String word = (this.isClaim() ? "claim" : "unclaim");
|
||||
|
@ -8,6 +8,7 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
@ -52,7 +53,7 @@ public class CmdFactionsSetAuto extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
final Faction newFaction;
|
||||
|
@ -4,6 +4,7 @@ import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
@ -38,7 +39,7 @@ public class CmdFactionsSetCircle extends CmdFactionsSetXRadius
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public Set<PS> getChunks()
|
||||
public Set<PS> getChunks() throws MassiveCommandException
|
||||
{
|
||||
// Common Startup
|
||||
final PS chunk = PS.valueOf(me.getLocation()).getChunk(true);
|
||||
|
@ -4,6 +4,7 @@ import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
@ -38,7 +39,7 @@ public class CmdFactionsSetSquare extends CmdFactionsSetXRadius
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public Set<PS> getChunks()
|
||||
public Set<PS> getChunks() throws MassiveCommandException
|
||||
{
|
||||
// Common Startup
|
||||
final PS chunk = PS.valueOf(me.getLocation()).getChunk(true);
|
||||
|
@ -5,6 +5,7 @@ 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.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
|
||||
|
||||
@ -44,14 +45,11 @@ public abstract class CmdFactionsSetX extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
final Faction newFaction = this.getNewFaction();
|
||||
if (newFaction == null) return;
|
||||
|
||||
final Set<PS> chunks = this.getChunks();
|
||||
if (chunks == null) return;
|
||||
|
||||
// Apply / Inform
|
||||
msender.tryClaim(newFaction, chunks, this.getFormatOne(), this.getFormatMany());
|
||||
@ -61,13 +59,13 @@ public abstract class CmdFactionsSetX extends FactionsCommand
|
||||
// ABSTRACT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public abstract Set<PS> getChunks();
|
||||
public abstract Set<PS> getChunks() throws MassiveCommandException;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// EXTRAS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public Faction getNewFaction()
|
||||
public Faction getNewFaction() throws MassiveCommandException
|
||||
{
|
||||
if (this.isClaim())
|
||||
{
|
||||
|
@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
|
||||
public abstract class CmdFactionsSetXAll extends CmdFactionsSetX
|
||||
{
|
||||
@ -28,7 +29,7 @@ public abstract class CmdFactionsSetXAll extends CmdFactionsSetX
|
||||
// EXTRAS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public Faction getOldFaction()
|
||||
public Faction getOldFaction() throws MassiveCommandException
|
||||
{
|
||||
return this.arg(1, ARFaction.get());
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARInteger;
|
||||
|
||||
|
||||
@ -28,7 +29,7 @@ public abstract class CmdFactionsSetXRadius extends CmdFactionsSetX
|
||||
// EXTRAS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public Integer getRadius()
|
||||
public Integer getRadius() throws MassiveCommandException
|
||||
{
|
||||
Integer radius = this.arg(0, ARInteger.get(), 1);
|
||||
if (radius == null) return radius;
|
||||
@ -50,7 +51,7 @@ public abstract class CmdFactionsSetXRadius extends CmdFactionsSetX
|
||||
return radius;
|
||||
}
|
||||
|
||||
public Integer getRadiusZero()
|
||||
public Integer getRadiusZero() throws MassiveCommandException
|
||||
{
|
||||
Integer ret = this.getRadius();
|
||||
if (ret == null) return ret;
|
||||
|
@ -6,6 +6,7 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.event.EventFactionsHomeChange;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
@ -34,11 +35,10 @@ public class CmdFactionsSethome extends FactionsCommandHome
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
PS newHome = PS.valueOf(me.getLocation());
|
||||
|
||||
|
@ -5,6 +5,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.event.EventFactionsPowerChange;
|
||||
import com.massivecraft.factions.event.EventFactionsPowerChange.PowerChangeReason;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARDouble;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
@ -32,13 +33,11 @@ public class CmdFactionsSetpower extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
|
||||
if (mplayer == null) return;
|
||||
Double power = this.arg(1, ARDouble.get());
|
||||
if (power == null) return;
|
||||
|
||||
// Power
|
||||
double oldPower = mplayer.getPower();
|
||||
|
@ -7,6 +7,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.event.EventFactionsTitleChange;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
@ -35,14 +36,11 @@ public class CmdFactionsTitle extends FactionsCommand
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
MPlayer you = this.arg(0, ARMPlayer.getAny());
|
||||
if (you == null) return;
|
||||
|
||||
String newTitle = this.argConcatFrom(1, ARString.get(), "");
|
||||
if (newTitle == null) return;
|
||||
|
||||
newTitle = Txt.parse(newTitle);
|
||||
if (!Perm.TITLE_COLOR.has(sender, false))
|
||||
|
@ -5,6 +5,7 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.event.EventFactionsHomeChange;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdFactionsUnsethome extends FactionsCommandHome
|
||||
@ -30,11 +31,10 @@ public class CmdFactionsUnsethome extends FactionsCommandHome
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
public void perform() throws MassiveCommandException
|
||||
{
|
||||
// Args
|
||||
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
// Any and MPerm
|
||||
if ( ! MPerm.getPermSethome().has(msender, faction, true)) return;
|
||||
|
@ -6,10 +6,9 @@ import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.FactionColl;
|
||||
import com.massivecraft.massivecore.MassiveCore;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommandException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ArgReaderAbstract;
|
||||
import com.massivecraft.massivecore.cmd.arg.ArgResult;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class ARFaction extends ArgReaderAbstract<Faction>
|
||||
{
|
||||
@ -25,39 +24,36 @@ public class ARFaction extends ArgReaderAbstract<Faction>
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public ArgResult<Faction> read(String str, CommandSender sender)
|
||||
public Faction read(String str, CommandSender sender) throws MassiveCommandException
|
||||
{
|
||||
ArgResult<Faction> result = new ArgResult<Faction>();
|
||||
Faction ret;
|
||||
|
||||
// Nothing/Remove targets Wilderness
|
||||
if (MassiveCore.NOTHING_REMOVE.contains(str))
|
||||
{
|
||||
result.setResult(FactionColl.get().getNone());
|
||||
return result;
|
||||
return FactionColl.get().getNone();
|
||||
}
|
||||
|
||||
// Faction Id Exact
|
||||
if (FactionColl.get().containsId(str))
|
||||
{
|
||||
result.setResult(FactionColl.get().get(str));
|
||||
if (result.hasResult()) return result;
|
||||
ret = FactionColl.get().get(str);
|
||||
if (ret != null) return ret;
|
||||
}
|
||||
|
||||
// Faction Name Exact
|
||||
result.setResult(FactionColl.get().getByName(str));
|
||||
if (result.hasResult()) return result;
|
||||
ret = FactionColl.get().getByName(str);
|
||||
if (ret != null) return ret;
|
||||
|
||||
// MPlayer Name Exact
|
||||
String id = IdUtil.getId(str);
|
||||
MPlayer mplayer = MPlayer.get(id);
|
||||
if (mplayer != null)
|
||||
{
|
||||
result.setResult(mplayer.getFaction());
|
||||
return result;
|
||||
return mplayer.getFaction();
|
||||
}
|
||||
|
||||
result.setErrors(Txt.parse("<b>No faction or player matching \"<p>%s<b>\".", str));
|
||||
return result;
|
||||
throw new MassiveCommandException().addMsg("<b>No faction or player matching \"<p>%s<b>\".", str);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user