MassiveCore Change - ArgReaders use Exceptions

This commit is contained in:
Olof Larsson 2015-02-04 01:30:07 +01:00
parent 8c27fe6505
commit 8322528652
44 changed files with 103 additions and 133 deletions

View File

@ -8,6 +8,7 @@ import com.massivecraft.factions.RelationParticipator;
import com.massivecraft.factions.TerritoryAccess; import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.ps.PSFormatHumanSpace; import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
@ -39,7 +40,7 @@ public abstract class CmdFactionsAccessAbstract extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
chunk = PS.valueOf(me.getLocation()).getChunk(true); chunk = PS.valueOf(me.getLocation()).getChunk(true);
ta = BoardColl.get().getTerritoryAccessAt(chunk); ta = BoardColl.get().getTerritoryAccessAt(chunk);
@ -48,7 +49,7 @@ public abstract class CmdFactionsAccessAbstract extends FactionsCommand
this.innerPerform(); this.innerPerform();
} }
public abstract void innerPerform(); public abstract void innerPerform() throws MassiveCommandException;
public void sendAccessInfo() public void sendAccessInfo()
{ {

View File

@ -5,6 +5,7 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARBoolean; import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
@ -32,14 +33,11 @@ public class CmdFactionsAccessFaction extends CmdFactionsAccessAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void innerPerform() public void innerPerform() throws MassiveCommandException
{ {
// Args // Args
Faction faction = this.arg(0, ARFaction.get()); Faction faction = this.arg(0, ARFaction.get());
if (faction == null) return;
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isFactionIdGranted(faction.getId())); Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isFactionIdGranted(faction.getId()));
if (newValue == null) return;
// MPerm // MPerm
if (!MPerm.getPermAccess().has(msender, hostFaction, true)) return; if (!MPerm.getPermAccess().has(msender, hostFaction, true)) return;

View File

@ -5,6 +5,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARBoolean; import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
@ -32,14 +33,11 @@ public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void innerPerform() public void innerPerform() throws MassiveCommandException
{ {
// Args // Args
MPlayer mplayer = this.arg(0, ARMPlayer.getAny()); MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
if (mplayer == null) return;
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isPlayerIdGranted(mplayer.getId())); Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isPlayerIdGranted(mplayer.getId()));
if (newValue == null) return;
// MPerm // MPerm
if (!MPerm.getPermAccess().has(msender, hostFaction, true)) return; if (!MPerm.getPermAccess().has(msender, hostFaction, true)) return;

View File

@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARBoolean; import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
@ -30,11 +31,10 @@ public class CmdFactionsAdmin extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
Boolean target = this.arg(0, ARBoolean.get(), !msender.isUsingAdminMode()); Boolean target = this.arg(0, ARBoolean.get(), !msender.isUsingAdminMode());
if (target == null) return;
// Apply // Apply
msender.setUsingAdminMode(target); msender.setUsingAdminMode(target);

View File

@ -12,6 +12,7 @@ import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason; import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
@ -39,11 +40,10 @@ public class CmdFactionsDisband extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
Faction faction = this.arg(0, ARFaction.get(), msenderFaction); Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
// MPerm // MPerm
if ( ! MPerm.getPermDisband().has(msender, faction, true)) return; if ( ! MPerm.getPermDisband().has(msender, faction, true)) return;

View File

@ -11,6 +11,7 @@ import com.massivecraft.factions.event.EventFactionsFactionShowAsync;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.massivecore.PriorityLines; import com.massivecraft.massivecore.PriorityLines;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
@ -38,11 +39,10 @@ public class CmdFactionsFaction extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
final Faction faction = this.arg(0, ARFaction.get(), msenderFaction); final Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
final CommandSender sender = this.sender; final CommandSender sender = this.sender;

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.entity.MFlag; import com.massivecraft.factions.entity.MFlag;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARInteger; import com.massivecraft.massivecore.cmd.arg.ARInteger;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
@ -32,11 +33,10 @@ public class CmdFactionsFlagList extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
Integer pageHumanBased = this.arg(0, ARInteger.get(), 1); Integer pageHumanBased = this.arg(0, ARInteger.get(), 1);
if (pageHumanBased == null) return;
//Create messages //Create messages
List<String> messages = new ArrayList<String>(); List<String> messages = new ArrayList<String>();

View File

@ -7,6 +7,7 @@ import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MFlag; import com.massivecraft.factions.entity.MFlag;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.event.EventFactionsFlagChange; import com.massivecraft.factions.event.EventFactionsFlagChange;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARBoolean; import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
@ -35,15 +36,12 @@ public class CmdFactionsFlagSet extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
MFlag flag = this.arg(0, ARMFlag.get()); MFlag flag = this.arg(0, ARMFlag.get());
if (flag == null) return;
Boolean value = this.arg(1, ARBoolean.get()); Boolean value = this.arg(1, ARBoolean.get());
if (value == null) return;
Faction faction = this.arg(2, ARFaction.get(), msenderFaction); Faction faction = this.arg(2, ARFaction.get(), msenderFaction);
if (faction == null) return;
// Do the sender have the right to change flags for this faction? // Do the sender have the right to change flags for this faction?
if ( ! MPerm.getPermFlags().has(msender, faction, true)) return; if ( ! MPerm.getPermFlags().has(msender, faction, true)) return;

View File

@ -8,6 +8,7 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.arg.ARMFlag; import com.massivecraft.factions.cmd.arg.ARMFlag;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MFlag; import com.massivecraft.factions.entity.MFlag;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARList; import com.massivecraft.massivecore.cmd.arg.ARList;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
@ -37,11 +38,10 @@ public class CmdFactionsFlagShow extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Arg: Faction // Arg: Faction
Faction faction = this.arg(0, ARFaction.get(), msenderFaction); Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
List<MFlag> flags = new ArrayList<MFlag>(); 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. // Arg: MFlag. Maybe we should use ARSet but that is currently buggy.
List<MFlag> mflags = this.arg(this.argConcatFrom(1), ARList.get(ARMFlag.get())); List<MFlag> mflags = this.arg(this.argConcatFrom(1), ARList.get(ARMFlag.get()));
if (mflags == null) return;
flags.addAll(mflags); flags.addAll(mflags);
} }

View File

@ -15,6 +15,7 @@ import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.EventFactionsHomeTeleport; 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.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.Mixin;
@ -46,7 +47,7 @@ public class CmdFactionsHome extends FactionsCommandHome
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
if ( ! MConf.get().homesTeleportCommandEnabled) if ( ! MConf.get().homesTeleportCommandEnabled)
{ {
@ -56,7 +57,6 @@ public class CmdFactionsHome extends FactionsCommandHome
// Args // Args
Faction faction = this.arg(0, ARFaction.get(), msenderFaction); Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
PS home = faction.getHome(); PS home = faction.getHome();
String homeDesc = "home for " + faction.describeTo(msender, false); String homeDesc = "home for " + faction.describeTo(msender, false);

View File

@ -8,6 +8,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsInvitedChange; 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.ARSet;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
@ -34,11 +35,10 @@ public class CmdFactionsInviteAdd extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
Set<MPlayer> mplayers = this.argConcatFrom(0, ARSet.get(ARMPlayer.getAny(), true)); Set<MPlayer> mplayers = this.argConcatFrom(0, ARSet.get(ARMPlayer.getAny(), true));
if (mplayers == null) return;
// MPerm // MPerm
if ( ! MPerm.getPermInvite().has(msender, msenderFaction, true)) return; if ( ! MPerm.getPermInvite().has(msender, msenderFaction, true)) return;

View File

@ -8,6 +8,7 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARInteger; import com.massivecraft.massivecore.cmd.arg.ARInteger;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.pager.PagerSimple; import com.massivecraft.massivecore.pager.PagerSimple;
@ -38,14 +39,12 @@ public class CmdFactionsInviteList extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
Integer pageHumanBased = this.arg(0, ARInteger.get(), 1); Integer pageHumanBased = this.arg(0, ARInteger.get(), 1);
if (pageHumanBased == null) return;
Faction faction = this.arg(1, ARFaction.get(), msenderFaction); Faction faction = this.arg(1, ARFaction.get(), msenderFaction);
if (faction == null) return;
if ( faction != msenderFaction && ! Perm.INVITE_LIST_OTHER.has(sender, true)) return; if ( faction != msenderFaction && ! Perm.INVITE_LIST_OTHER.has(sender, true)) return;

View File

@ -10,6 +10,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsInvitedChange; 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.ARSet;
import com.massivecraft.massivecore.cmd.arg.ARString; import com.massivecraft.massivecore.cmd.arg.ARString;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
@ -37,7 +38,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
Set<MPlayer> mplayers = new HashSet<MPlayer>(); Set<MPlayer> mplayers = new HashSet<MPlayer>();
boolean all = false; boolean all = false;
@ -58,7 +59,6 @@ public class CmdFactionsInviteRemove extends FactionsCommand
else else
{ {
Set<MPlayer> senderInput = this.argConcatFrom(0, ARSet.get(ARMPlayer.getAny(), true)); Set<MPlayer> senderInput = this.argConcatFrom(0, ARSet.get(ARMPlayer.getAny(), true));
if (senderInput == null) return;
mplayers.addAll(senderInput); mplayers.addAll(senderInput);
} }

View File

@ -10,6 +10,7 @@ import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.EventFactionsMembershipChange; import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason; import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
@ -37,14 +38,12 @@ public class CmdFactionsJoin extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
Faction faction = this.arg(0, ARFaction.get()); Faction faction = this.arg(0, ARFaction.get());
if (faction == null) return;
MPlayer mplayer = this.arg(1, ARMPlayer.getAny(), msender); MPlayer mplayer = this.arg(1, ARMPlayer.getAny(), msender);
if (mplayer == null) return;
Faction mplayerFaction = mplayer.getFaction(); Faction mplayerFaction = mplayer.getFaction();
boolean samePlayer = mplayer == msender; boolean samePlayer = mplayer == msender;

View File

@ -11,6 +11,7 @@ import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.EventFactionsMembershipChange; import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason; import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
@ -37,11 +38,10 @@ public class CmdFactionsKick extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Arg // Arg
MPlayer mplayer = this.arg(0, ARMPlayer.getAny()); MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
if (mplayer == null) return;
// Validate // Validate
if (msender == mplayer) if (msender == mplayer)

View File

@ -10,6 +10,7 @@ import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARInteger; import com.massivecraft.massivecore.cmd.arg.ARInteger;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.Mixin;
@ -40,11 +41,10 @@ public class CmdFactionsList extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
final Integer pageHumanBased = this.arg(0, ARInteger.get(), 1); final Integer pageHumanBased = this.arg(0, ARInteger.get(), 1);
if (pageHumanBased == null) return;
// NOTE: The faction list is quite slow and mostly thread safe. // NOTE: The faction list is quite slow and mostly thread safe.
// We run it asynchronously to spare the primary server thread. // We run it asynchronously to spare the primary server thread.

View File

@ -7,6 +7,7 @@ import org.bukkit.Location;
import com.massivecraft.factions.Const; import com.massivecraft.factions.Const;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARBoolean; import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
@ -36,7 +37,7 @@ public class CmdFactionsMap extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
if ( ! this.argIsSet(0)) if ( ! this.argIsSet(0))
{ {

View File

@ -5,6 +5,7 @@ import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsMoneyBalance extends FactionsCommand public class CmdFactionsMoneyBalance extends FactionsCommand
@ -31,11 +32,10 @@ public class CmdFactionsMoneyBalance extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
Faction faction = this.arg(0, ARFaction.get(), msenderFaction); Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
if (faction != msenderFaction && ! Perm.MONEY_BALANCE_ANY.has(sender, true)) return; if (faction != msenderFaction && ! Perm.MONEY_BALANCE_ANY.has(sender, true)) return;
Econ.sendBalanceInfo(msender, faction); Econ.sendBalanceInfo(msender, faction);

View File

@ -7,6 +7,7 @@ import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARDouble; import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.money.Money; import com.massivecraft.massivecore.money.Money;
@ -39,13 +40,11 @@ public class CmdFactionsMoneyDeposit extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
Double amount = this.arg(0, ARDouble.get()); Double amount = this.arg(0, ARDouble.get());
if (amount == null) return;
Faction faction = this.arg(1, ARFaction.get(), msenderFaction); Faction faction = this.arg(1, ARFaction.get(), msenderFaction);
if (faction == null) return;
boolean success = Econ.transferMoney(msender, msender, faction, amount); boolean success = Econ.transferMoney(msender, msender, faction, amount);

View File

@ -7,6 +7,7 @@ import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARDouble; import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.money.Money; import com.massivecraft.massivecore.money.Money;
@ -41,16 +42,11 @@ public class CmdFactionsMoneyTransferFf extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
Double amount = this.arg(0, ARDouble.get()); Double amount = this.arg(0, ARDouble.get());
if (amount == null) return;
Faction from = this.arg(1, ARFaction.get()); Faction from = this.arg(1, ARFaction.get());
if (from == null) return;
Faction to = this.arg(2, ARFaction.get()); Faction to = this.arg(2, ARFaction.get());
if (to == null) return;
boolean success = Econ.transferMoney(msender, from, to, amount); boolean success = Econ.transferMoney(msender, from, to, amount);

View File

@ -9,6 +9,7 @@ import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARDouble; import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.money.Money; import com.massivecraft.massivecore.money.Money;
@ -43,16 +44,11 @@ public class CmdFactionsMoneyTransferFp extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
Double amount = this.arg(0, ARDouble.get()); Double amount = this.arg(0, ARDouble.get());
if (amount == null) return;
Faction from = this.arg(1, ARFaction.get()); Faction from = this.arg(1, ARFaction.get());
if (from == null) return;
MPlayer to = this.arg(2, ARMPlayer.getAny()); MPlayer to = this.arg(2, ARMPlayer.getAny());
if (to == null) return;
boolean success = Econ.transferMoney(msender, from, to, amount); boolean success = Econ.transferMoney(msender, from, to, amount);

View File

@ -9,6 +9,7 @@ import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARDouble; import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.money.Money; import com.massivecraft.massivecore.money.Money;
@ -43,16 +44,11 @@ public class CmdFactionsMoneyTransferPf extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
Double amount = this.arg(0, ARDouble.get()); Double amount = this.arg(0, ARDouble.get());
if (amount == null) return;
MPlayer from = this.arg(1, ARMPlayer.getAny()); MPlayer from = this.arg(1, ARMPlayer.getAny());
if (from == null) return;
Faction to = this.arg(2, ARFaction.get()); Faction to = this.arg(2, ARFaction.get());
if (to == null) return;
boolean success = Econ.transferMoney(msender, from, to, amount); boolean success = Econ.transferMoney(msender, from, to, amount);

View File

@ -8,6 +8,7 @@ import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARDouble; import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.money.Money; import com.massivecraft.massivecore.money.Money;
@ -41,13 +42,10 @@ public class CmdFactionsMoneyWithdraw extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
Double amount = this.arg(0, ARDouble.get()); Double amount = this.arg(0, ARDouble.get());
if (amount == null) return;
Faction from = this.arg(1, ARFaction.get(), msenderFaction); Faction from = this.arg(1, ARFaction.get(), msenderFaction);
if (from == null) return;
MPlayer to = msender; MPlayer to = msender;

View File

@ -9,6 +9,7 @@ import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.event.EventFactionsNameChange; import com.massivecraft.factions.event.EventFactionsNameChange;
import com.massivecraft.factions.util.MiscUtil; import com.massivecraft.factions.util.MiscUtil;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsName extends FactionsCommand public class CmdFactionsName extends FactionsCommand
@ -35,13 +36,12 @@ public class CmdFactionsName extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
String newName = this.arg(0); String newName = this.arg(0);
Faction faction = this.arg(1, ARFaction.get(), msenderFaction); Faction faction = this.arg(1, ARFaction.get(), msenderFaction);
if (faction == null) return;
// MPerm // MPerm
if ( ! MPerm.getPermName().has(msender, faction, true)) return; if ( ! MPerm.getPermName().has(msender, faction, true)) return;

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARInteger; import com.massivecraft.massivecore.cmd.arg.ARInteger;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
@ -32,11 +33,10 @@ public class CmdFactionsPermList extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
Integer pageHumanBased = this.arg(0, ARInteger.get(), 1); Integer pageHumanBased = this.arg(0, ARInteger.get(), 1);
if (pageHumanBased == null) return;
// Create messages // Create messages
List<String> messages = new ArrayList<String>(); List<String> messages = new ArrayList<String>();

View File

@ -11,6 +11,7 @@ import com.massivecraft.factions.cmd.arg.ARRel;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARBoolean; import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
@ -41,17 +42,13 @@ public class CmdFactionsPermSet extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
MPerm perm = this.arg(0, ARMPerm.get()); MPerm perm = this.arg(0, ARMPerm.get());
if (perm == null) return;
Rel rel = this.arg(1, ARRel.get()); Rel rel = this.arg(1, ARRel.get());
if (rel == null) return;
Boolean value = this.arg(2, ARBoolean.get()); Boolean value = this.arg(2, ARBoolean.get());
if (value == null) return;
Faction faction = this.arg(3, ARFaction.get(), msenderFaction); Faction faction = this.arg(3, ARFaction.get(), msenderFaction);
if (faction == null) return;
// Do the sender have the right to change perms for this faction? // Do the sender have the right to change perms for this faction?
if ( ! MPerm.getPermPerms().has(msender, faction, true)) return; if ( ! MPerm.getPermPerms().has(msender, faction, true)) return;

View File

@ -8,6 +8,7 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.arg.ARMPerm; import com.massivecraft.factions.cmd.arg.ARMPerm;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARList; import com.massivecraft.massivecore.cmd.arg.ARList;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
@ -37,11 +38,10 @@ public class CmdFactionsPermShow extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Arg: Faction // Arg: Faction
Faction faction = this.arg(0, ARFaction.get(), msenderFaction); Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
List<MPerm> perms = new ArrayList<MPerm>(); 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. // Arg perm. Maybe we should use ARSet but that is currently buggy.
List<MPerm> mperms = this.arg(this.argConcatFrom(1), ARList.get(ARMPerm.get())); List<MPerm> mperms = this.arg(this.argConcatFrom(1), ARList.get(ARMPerm.get()));
if (mperms == null) return;
perms.addAll(mperms); perms.addAll(mperms);
} }

View File

@ -9,6 +9,7 @@ import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsRemovePlayerMillis; import com.massivecraft.factions.event.EventFactionsRemovePlayerMillis;
import com.massivecraft.massivecore.Progressbar; import com.massivecraft.massivecore.Progressbar;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.TimeDiffUtil; import com.massivecraft.massivecore.util.TimeDiffUtil;
import com.massivecraft.massivecore.util.TimeUnit; import com.massivecraft.massivecore.util.TimeUnit;
@ -37,11 +38,10 @@ public class CmdFactionsPlayer extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
MPlayer mplayer = this.arg(0, ARMPlayer.getAny(), msender); MPlayer mplayer = this.arg(0, ARMPlayer.getAny(), msender);
if (mplayer == null) return;
// INFO: Title // INFO: Title
msg(Txt.titleize("Player " + mplayer.describeTo(msender))); msg(Txt.titleize("Player " + mplayer.describeTo(msender)));

View File

@ -6,6 +6,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARDouble; import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
@ -34,7 +35,7 @@ public class CmdFactionsPowerBoost extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
String type = this.arg(0).toLowerCase(); String type = this.arg(0).toLowerCase();
boolean doPlayer = true; boolean doPlayer = true;
@ -50,14 +51,12 @@ public class CmdFactionsPowerBoost extends FactionsCommand
} }
Double targetPower = this.arg(2, ARDouble.get()); Double targetPower = this.arg(2, ARDouble.get());
if (targetPower == null) return;
String target; String target;
if (doPlayer) if (doPlayer)
{ {
MPlayer targetPlayer = this.arg(1, ARMPlayer.getAny()); MPlayer targetPlayer = this.arg(1, ARMPlayer.getAny());
if (targetPlayer == null) return;
targetPlayer.setPowerBoost(targetPower); targetPlayer.setPowerBoost(targetPower);
target = "Player \""+targetPlayer.getName()+"\""; target = "Player \""+targetPlayer.getName()+"\"";
@ -65,7 +64,6 @@ public class CmdFactionsPowerBoost extends FactionsCommand
else else
{ {
Faction targetFaction = this.arg(1, ARFaction.get()); Faction targetFaction = this.arg(1, ARFaction.get());
if (targetFaction == null) return;
targetFaction.setPowerBoost(targetPower); targetFaction.setPowerBoost(targetPower);
target = "Faction \""+targetFaction.getName()+"\""; target = "Faction \""+targetFaction.getName()+"\"";

View File

@ -13,6 +13,7 @@ import com.massivecraft.factions.entity.MFlag;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.MPlayerColl; import com.massivecraft.factions.entity.MPlayerColl;
import com.massivecraft.factions.event.EventFactionsRankChange; import com.massivecraft.factions.event.EventFactionsRankChange;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
@ -63,7 +64,7 @@ public class CmdFactionsRank extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// This sets target and much other. Returns false if not succeeded. // This sets target and much other. Returns false if not succeeded.
if ( ! this.registerFields()) if ( ! this.registerFields())
@ -121,7 +122,7 @@ public class CmdFactionsRank extends FactionsCommand
// PRIVATE // PRIVATE
// -------------------------------------------- // // -------------------------------------------- //
private boolean registerFields() private boolean registerFields() throws MassiveCommandException
{ {
// Getting the target and faction. // Getting the target and faction.
target = this.arg(0, ARMPlayer.getAny(), msender); target = this.arg(0, ARMPlayer.getAny(), msender);

View File

@ -9,6 +9,7 @@ import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MFlag; import com.massivecraft.factions.entity.MFlag;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.event.EventFactionsRelationChange; import com.massivecraft.factions.event.EventFactionsRelationChange;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public abstract class CmdFactionsRelationAbstract extends FactionsCommand public abstract class CmdFactionsRelationAbstract extends FactionsCommand
@ -34,11 +35,10 @@ public abstract class CmdFactionsRelationAbstract extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
Faction otherFaction = this.arg(0, ARFaction.get()); Faction otherFaction = this.arg(0, ARFaction.get());
if (otherFaction == null) return;
Rel newRelation = targetRelation; Rel newRelation = targetRelation;

View File

@ -1,6 +1,7 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARBoolean; import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
@ -30,13 +31,12 @@ public class CmdFactionsSeeChunk extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
boolean old = msender.isSeeingChunk(); boolean old = msender.isSeeingChunk();
boolean targetDefault = !old; boolean targetDefault = !old;
Boolean target = this.arg(0, ARBoolean.get(), targetDefault); Boolean target = this.arg(0, ARBoolean.get(), targetDefault);
if (target == null) return;
String targetDesc = Txt.parse(target ? "<g>ON": "<b>OFF"); String targetDesc = Txt.parse(target ? "<g>ON": "<b>OFF");
// NoChange // NoChange

View File

@ -6,6 +6,7 @@ import com.massivecraft.factions.Perm;
import com.massivecraft.factions.entity.Board; import com.massivecraft.factions.entity.Board;
import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARWorldId; import com.massivecraft.massivecore.cmd.arg.ARWorldId;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
@ -39,7 +40,7 @@ public class CmdFactionsSetAll extends CmdFactionsSetXAll
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public Set<PS> getChunks() public Set<PS> getChunks() throws MassiveCommandException
{ {
// World // World
String word = (this.isClaim() ? "claim" : "unclaim"); String word = (this.isClaim() ? "claim" : "unclaim");

View File

@ -8,6 +8,7 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.MPerm; 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.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
@ -52,7 +53,7 @@ public class CmdFactionsSetAuto extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
final Faction newFaction; final Faction newFaction;

View File

@ -4,6 +4,7 @@ import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
@ -38,7 +39,7 @@ public class CmdFactionsSetCircle extends CmdFactionsSetXRadius
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public Set<PS> getChunks() public Set<PS> getChunks() throws MassiveCommandException
{ {
// Common Startup // Common Startup
final PS chunk = PS.valueOf(me.getLocation()).getChunk(true); final PS chunk = PS.valueOf(me.getLocation()).getChunk(true);

View File

@ -4,6 +4,7 @@ import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
@ -38,7 +39,7 @@ public class CmdFactionsSetSquare extends CmdFactionsSetXRadius
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public Set<PS> getChunks() public Set<PS> getChunks() throws MassiveCommandException
{ {
// Common Startup // Common Startup
final PS chunk = PS.valueOf(me.getLocation()).getChunk(true); final PS chunk = PS.valueOf(me.getLocation()).getChunk(true);

View File

@ -5,6 +5,7 @@ import java.util.Set;
import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
@ -44,14 +45,11 @@ public abstract class CmdFactionsSetX extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
final Faction newFaction = this.getNewFaction(); final Faction newFaction = this.getNewFaction();
if (newFaction == null) return;
final Set<PS> chunks = this.getChunks(); final Set<PS> chunks = this.getChunks();
if (chunks == null) return;
// Apply / Inform // Apply / Inform
msender.tryClaim(newFaction, chunks, this.getFormatOne(), this.getFormatMany()); msender.tryClaim(newFaction, chunks, this.getFormatOne(), this.getFormatMany());
@ -61,13 +59,13 @@ public abstract class CmdFactionsSetX extends FactionsCommand
// ABSTRACT // ABSTRACT
// -------------------------------------------- // // -------------------------------------------- //
public abstract Set<PS> getChunks(); public abstract Set<PS> getChunks() throws MassiveCommandException;
// -------------------------------------------- // // -------------------------------------------- //
// EXTRAS // EXTRAS
// -------------------------------------------- // // -------------------------------------------- //
public Faction getNewFaction() public Faction getNewFaction() throws MassiveCommandException
{ {
if (this.isClaim()) if (this.isClaim())
{ {

View File

@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.cmd.arg.ARFaction; import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
public abstract class CmdFactionsSetXAll extends CmdFactionsSetX public abstract class CmdFactionsSetXAll extends CmdFactionsSetX
{ {
@ -28,7 +29,7 @@ public abstract class CmdFactionsSetXAll extends CmdFactionsSetX
// EXTRAS // EXTRAS
// -------------------------------------------- // // -------------------------------------------- //
public Faction getOldFaction() public Faction getOldFaction() throws MassiveCommandException
{ {
return this.arg(1, ARFaction.get()); return this.arg(1, ARFaction.get());
} }

View File

@ -1,6 +1,7 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARInteger; import com.massivecraft.massivecore.cmd.arg.ARInteger;
@ -28,7 +29,7 @@ public abstract class CmdFactionsSetXRadius extends CmdFactionsSetX
// EXTRAS // EXTRAS
// -------------------------------------------- // // -------------------------------------------- //
public Integer getRadius() public Integer getRadius() throws MassiveCommandException
{ {
Integer radius = this.arg(0, ARInteger.get(), 1); Integer radius = this.arg(0, ARInteger.get(), 1);
if (radius == null) return radius; if (radius == null) return radius;
@ -50,7 +51,7 @@ public abstract class CmdFactionsSetXRadius extends CmdFactionsSetX
return radius; return radius;
} }
public Integer getRadiusZero() public Integer getRadiusZero() throws MassiveCommandException
{ {
Integer ret = this.getRadius(); Integer ret = this.getRadius();
if (ret == null) return ret; if (ret == null) return ret;

View File

@ -6,6 +6,7 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.event.EventFactionsHomeChange; 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.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer; import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
@ -34,11 +35,10 @@ public class CmdFactionsSethome extends FactionsCommandHome
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
Faction faction = this.arg(0, ARFaction.get(), msenderFaction); Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
PS newHome = PS.valueOf(me.getLocation()); PS newHome = PS.valueOf(me.getLocation());

View File

@ -5,6 +5,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsPowerChange; import com.massivecraft.factions.event.EventFactionsPowerChange;
import com.massivecraft.factions.event.EventFactionsPowerChange.PowerChangeReason; 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.arg.ARDouble;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
@ -32,13 +33,11 @@ public class CmdFactionsSetpower extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
MPlayer mplayer = this.arg(0, ARMPlayer.getAny()); MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
if (mplayer == null) return;
Double power = this.arg(1, ARDouble.get()); Double power = this.arg(1, ARDouble.get());
if (power == null) return;
// Power // Power
double oldPower = mplayer.getPower(); double oldPower = mplayer.getPower();

View File

@ -7,6 +7,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsTitleChange; import com.massivecraft.factions.event.EventFactionsTitleChange;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ARString; import com.massivecraft.massivecore.cmd.arg.ARString;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm; import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
@ -35,14 +36,11 @@ public class CmdFactionsTitle extends FactionsCommand
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
MPlayer you = this.arg(0, ARMPlayer.getAny()); MPlayer you = this.arg(0, ARMPlayer.getAny());
if (you == null) return;
String newTitle = this.argConcatFrom(1, ARString.get(), ""); String newTitle = this.argConcatFrom(1, ARString.get(), "");
if (newTitle == null) return;
newTitle = Txt.parse(newTitle); newTitle = Txt.parse(newTitle);
if (!Perm.TITLE_COLOR.has(sender, false)) if (!Perm.TITLE_COLOR.has(sender, false))

View File

@ -5,6 +5,7 @@ import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.event.EventFactionsHomeChange; 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.ReqHasPerm;
public class CmdFactionsUnsethome extends FactionsCommandHome public class CmdFactionsUnsethome extends FactionsCommandHome
@ -30,11 +31,10 @@ public class CmdFactionsUnsethome extends FactionsCommandHome
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void perform() public void perform() throws MassiveCommandException
{ {
// Args // Args
Faction faction = this.arg(0, ARFaction.get(), msenderFaction); Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
// Any and MPerm // Any and MPerm
if ( ! MPerm.getPermSethome().has(msender, faction, true)) return; if ( ! MPerm.getPermSethome().has(msender, faction, true)) return;

View File

@ -6,10 +6,9 @@ import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.massivecore.MassiveCore; import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.cmd.MassiveCommandException;
import com.massivecraft.massivecore.cmd.arg.ArgReaderAbstract; 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.IdUtil;
import com.massivecraft.massivecore.util.Txt;
public class ARFaction extends ArgReaderAbstract<Faction> public class ARFaction extends ArgReaderAbstract<Faction>
{ {
@ -25,39 +24,36 @@ public class ARFaction extends ArgReaderAbstract<Faction>
// -------------------------------------------- // // -------------------------------------------- //
@Override @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 // Nothing/Remove targets Wilderness
if (MassiveCore.NOTHING_REMOVE.contains(str)) if (MassiveCore.NOTHING_REMOVE.contains(str))
{ {
result.setResult(FactionColl.get().getNone()); return FactionColl.get().getNone();
return result;
} }
// Faction Id Exact // Faction Id Exact
if (FactionColl.get().containsId(str)) if (FactionColl.get().containsId(str))
{ {
result.setResult(FactionColl.get().get(str)); ret = FactionColl.get().get(str);
if (result.hasResult()) return result; if (ret != null) return ret;
} }
// Faction Name Exact // Faction Name Exact
result.setResult(FactionColl.get().getByName(str)); ret = FactionColl.get().getByName(str);
if (result.hasResult()) return result; if (ret != null) return ret;
// MPlayer Name Exact // MPlayer Name Exact
String id = IdUtil.getId(str); String id = IdUtil.getId(str);
MPlayer mplayer = MPlayer.get(id); MPlayer mplayer = MPlayer.get(id);
if (mplayer != null) if (mplayer != null)
{ {
result.setResult(mplayer.getFaction()); return mplayer.getFaction();
return result;
} }
result.setErrors(Txt.parse("<b>No faction or player matching \"<p>%s<b>\".", str)); throw new MassiveCommandException().addMsg("<b>No faction or player matching \"<p>%s<b>\".", str);
return result;
} }
} }