From 3cdd5764d33bd8a7b92661ced48e7a20b142e153 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Sun, 9 Oct 2011 20:10:19 +0200 Subject: [PATCH] derp --- src/plugin.yml => plugin.yml | 61 +++----- src/com/massivecraft/factions/Faction.java | 21 +-- src/com/massivecraft/factions/P.java | 87 ++---------- .../{FCommandAdmin.java => CmdAdmin.java} | 4 +- ...ommandAutoClaim.java => CmdAutoClaim.java} | 4 +- ...toSafeclaim.java => CmdAutoSafeclaim.java} | 4 +- ...AutoWarclaim.java => CmdAutoWarclaim.java} | 4 +- .../{FCommandBalance.java => CmdBalance.java} | 6 +- .../factions/commands/CmdBase.java | 42 ------ .../{FCommandNoBoom.java => CmdBoom.java} | 4 +- .../{FCommandBypass.java => CmdBypass.java} | 4 +- .../{FCommandChat.java => CmdChat.java} | 4 +- .../{FCommandClaim.java => CmdClaim.java} | 4 +- .../{FCommandConfig.java => CmdConfig.java} | 19 +-- .../{FCommandCreate.java => CmdCreate.java} | 8 +- ...FCommandDeinvite.java => CmdDeinvite.java} | 6 +- .../{FCommandDeposit.java => CmdDeposit.java} | 4 +- ...ndDescription.java => CmdDescription.java} | 4 +- .../{FCommandDisband.java => CmdDisband.java} | 4 +- .../{FCommandHelp.java => CmdHelp.java} | 104 +++++++------- .../{FCommandHome.java => CmdHome.java} | 6 +- .../{FCommandInvite.java => CmdInvite.java} | 6 +- .../{FCommandJoin.java => CmdJoin.java} | 4 +- .../{FCommandKick.java => CmdKick.java} | 6 +- .../{FCommandLeave.java => CmdLeave.java} | 4 +- .../{FCommandList.java => CmdList.java} | 4 +- .../{FCommandLock.java => CmdLock.java} | 4 +- .../{FCommandMap.java => CmdMap.java} | 4 +- .../{FCommandMod.java => CmdMod.java} | 4 +- .../{FCommandOpen.java => CmdOpen.java} | 4 +- .../{FCommandOwner.java => CmdOwner.java} | 4 +- ...ommandOwnerList.java => CmdOwnerList.java} | 4 +- .../{FCommandPay.java => CmdPay.java} | 4 +- ...FCommandPeaceful.java => CmdPeaceful.java} | 4 +- ...ommandPermanent.java => CmdPermanent.java} | 4 +- .../{FCommandPower.java => CmdPower.java} | 4 +- ...RelationAlly.java => CmdRelationAlly.java} | 4 +- ...lationEnemy.java => CmdRelationEnemy.java} | 4 +- ...onNeutral.java => CmdRelationNeutral.java} | 4 +- .../{FCommandReload.java => CmdReload.java} | 4 +- ...ommandSafeclaim.java => CmdSafeclaim.java} | 6 +- ...unclaimall.java => CmdSafeunclaimall.java} | 4 +- .../{FCommandSaveAll.java => CmdSaveAll.java} | 4 +- .../{FCommandSethome.java => CmdSethome.java} | 6 +- .../{FCommandShow.java => CmdShow.java} | 4 +- .../{FCommandTag.java => CmdTag.java} | 4 +- .../{FCommandTitle.java => CmdTitle.java} | 4 +- .../{FCommandUnclaim.java => CmdUnclaim.java} | 4 +- .../factions/commands/CmdUnclaimall.java | 90 ++++++++++++ .../{FCommandVersion.java => CmdVersion.java} | 4 +- .../factions/commands/CmdWarclaim.java | 53 +++++++ .../factions/commands/CmdWarunclaimall.java | 42 ++++++ ...FCommandWithdraw.java => CmdWithdraw.java} | 4 +- .../factions/commands/FCmdRoot.java | 131 ++++++++++++++++++ .../factions/commands/FCommandUnclaimall.java | 75 ---------- .../factions/commands/FCommandWarclaim.java | 63 --------- .../commands/FCommandWarunclaimall.java | 35 ----- .../factions/integration/Econ.java | 8 +- .../factions/struct/Permission.java | 30 ++-- .../massivecraft/factions/zcore/MCommand.java | 37 ++--- .../massivecraft/factions/zcore/MPlugin.java | 8 +- 61 files changed, 556 insertions(+), 544 deletions(-) rename src/plugin.yml => plugin.yml (80%) rename src/com/massivecraft/factions/commands/{FCommandAdmin.java => CmdAdmin.java} (95%) rename src/com/massivecraft/factions/commands/{FCommandAutoClaim.java => CmdAutoClaim.java} (94%) rename src/com/massivecraft/factions/commands/{FCommandAutoSafeclaim.java => CmdAutoSafeclaim.java} (93%) rename src/com/massivecraft/factions/commands/{FCommandAutoWarclaim.java => CmdAutoWarclaim.java} (93%) rename src/com/massivecraft/factions/commands/{FCommandBalance.java => CmdBalance.java} (88%) delete mode 100644 src/com/massivecraft/factions/commands/CmdBase.java rename src/com/massivecraft/factions/commands/{FCommandNoBoom.java => CmdBoom.java} (94%) rename src/com/massivecraft/factions/commands/{FCommandBypass.java => CmdBypass.java} (93%) rename src/com/massivecraft/factions/commands/{FCommandChat.java => CmdChat.java} (95%) rename src/com/massivecraft/factions/commands/{FCommandClaim.java => CmdClaim.java} (89%) rename src/com/massivecraft/factions/commands/{FCommandConfig.java => CmdConfig.java} (94%) rename src/com/massivecraft/factions/commands/{FCommandCreate.java => CmdCreate.java} (89%) rename src/com/massivecraft/factions/commands/{FCommandDeinvite.java => CmdDeinvite.java} (86%) rename src/com/massivecraft/factions/commands/{FCommandDeposit.java => CmdDeposit.java} (95%) rename src/com/massivecraft/factions/commands/{FCommandDescription.java => CmdDescription.java} (93%) rename src/com/massivecraft/factions/commands/{FCommandDisband.java => CmdDisband.java} (93%) rename src/com/massivecraft/factions/commands/{FCommandHelp.java => CmdHelp.java} (58%) rename src/com/massivecraft/factions/commands/{FCommandHome.java => CmdHome.java} (96%) rename src/com/massivecraft/factions/commands/{FCommandInvite.java => CmdInvite.java} (88%) rename src/com/massivecraft/factions/commands/{FCommandJoin.java => CmdJoin.java} (96%) rename src/com/massivecraft/factions/commands/{FCommandKick.java => CmdKick.java} (93%) rename src/com/massivecraft/factions/commands/{FCommandLeave.java => CmdLeave.java} (88%) rename src/com/massivecraft/factions/commands/{FCommandList.java => CmdList.java} (97%) rename src/com/massivecraft/factions/commands/{FCommandLock.java => CmdLock.java} (88%) rename src/com/massivecraft/factions/commands/{FCommandMap.java => CmdMap.java} (95%) rename src/com/massivecraft/factions/commands/{FCommandMod.java => CmdMod.java} (95%) rename src/com/massivecraft/factions/commands/{FCommandOpen.java => CmdOpen.java} (94%) rename src/com/massivecraft/factions/commands/{FCommandOwner.java => CmdOwner.java} (97%) rename src/com/massivecraft/factions/commands/{FCommandOwnerList.java => CmdOwnerList.java} (95%) rename src/com/massivecraft/factions/commands/{FCommandPay.java => CmdPay.java} (96%) rename src/com/massivecraft/factions/commands/{FCommandPeaceful.java => CmdPeaceful.java} (90%) rename src/com/massivecraft/factions/commands/{FCommandPermanent.java => CmdPermanent.java} (90%) rename src/com/massivecraft/factions/commands/{FCommandPower.java => CmdPower.java} (93%) rename src/com/massivecraft/factions/commands/{FCommandRelationAlly.java => CmdRelationAlly.java} (64%) rename src/com/massivecraft/factions/commands/{FCommandRelationEnemy.java => CmdRelationEnemy.java} (64%) rename src/com/massivecraft/factions/commands/{FCommandRelationNeutral.java => CmdRelationNeutral.java} (63%) rename src/com/massivecraft/factions/commands/{FCommandReload.java => CmdReload.java} (91%) rename src/com/massivecraft/factions/commands/{FCommandSafeclaim.java => CmdSafeclaim.java} (91%) rename src/com/massivecraft/factions/commands/{FCommandSafeunclaimall.java => CmdSafeunclaimall.java} (90%) rename src/com/massivecraft/factions/commands/{FCommandSaveAll.java => CmdSaveAll.java} (87%) rename src/com/massivecraft/factions/commands/{FCommandSethome.java => CmdSethome.java} (93%) rename src/com/massivecraft/factions/commands/{FCommandShow.java => CmdShow.java} (98%) rename src/com/massivecraft/factions/commands/{FCommandTag.java => CmdTag.java} (96%) rename src/com/massivecraft/factions/commands/{FCommandTitle.java => CmdTitle.java} (95%) rename src/com/massivecraft/factions/commands/{FCommandUnclaim.java => CmdUnclaim.java} (97%) create mode 100644 src/com/massivecraft/factions/commands/CmdUnclaimall.java rename src/com/massivecraft/factions/commands/{FCommandVersion.java => CmdVersion.java} (88%) create mode 100644 src/com/massivecraft/factions/commands/CmdWarclaim.java create mode 100644 src/com/massivecraft/factions/commands/CmdWarunclaimall.java rename src/com/massivecraft/factions/commands/{FCommandWithdraw.java => CmdWithdraw.java} (96%) create mode 100644 src/com/massivecraft/factions/commands/FCmdRoot.java delete mode 100644 src/com/massivecraft/factions/commands/FCommandUnclaimall.java delete mode 100644 src/com/massivecraft/factions/commands/FCommandWarclaim.java delete mode 100644 src/com/massivecraft/factions/commands/FCommandWarunclaimall.java diff --git a/src/plugin.yml b/plugin.yml similarity index 80% rename from src/plugin.yml rename to plugin.yml index 34e055f4..f4717f80 100644 --- a/src/plugin.yml +++ b/plugin.yml @@ -21,55 +21,32 @@ permissions: factions.*: description: Grants all Factions permissions children: - factions.participate: true - factions.create: true - factions.viewAnyPower: true - factions.viewAnyFactionBalance: true - factions.peacefulExplosionToggle: true - factions.adminBypass: true - factions.config: true - factions.disband: true - factions.lock: true - factions.manageSafeZone: true - factions.manageWarZone: true - factions.ownershipBypass: true - factions.reload: true - factions.saveall: true - factions.setPeaceful: true - factions.setPermanent: true - factions.commandDisable.none: true - factions.participate: - description: participate in a faction - default: true - factions.create: - description: create a new faction - default: true - factions.viewAnyFactionBalance: - description: view the faction bank balance for any faction - default: true - factions.peacefulExplosionToggle: - description: disable explosions in your territory as a peaceful faction admin or moderator - default: true - factions.manageSafeZone: + factions.*: + description: Grants all Factions permissions + children: + + + factions.managesafezone: description: claim land as a safe zone and build/destroy within safe zones default: op - factions.manageWarZone: + factions.managewarzone: description: claim land as a war zone and build/destroy within war zones default: op - factions.ownershipBypass: + factions.ownershipbypass: description: bypass ownership restrictions within own faction's territory default: op - - factions.command.admin: description: hand over your admin rights default: true - factions.command.autoClaim: + factions.command.autoclaim: description: auto-claim land as you walk around default: true factions.command.balance: description: show current faction balance default: true + factions.command.balance.any: + description: show on other factions balance + default: true factions.command.withdraw: description: withdraw money from your faction bank default: true @@ -88,6 +65,9 @@ permissions: factions.command.config: description: change a conf.json setting default: op + factions.create: + description: create a new faction + default: true factions.command.deinvite: description: remove a pending invitation default: true @@ -133,7 +113,7 @@ permissions: factions.command.mod: description: give or revoke moderator rights default: true - factions.command.noBoom: + factions.command.noboom: description: toggle explosions (peaceful factions only) default: true factions.command.open: @@ -145,10 +125,10 @@ permissions: factions.command.ownerlist: description: list owner(s) of this claimed land default: true - factions.command.setPeaceful: + factions.command.setpeaceful: description: designate a faction as peaceful default: op - factions.command.setPermanent: + factions.command.setpermanent: description: designate a faction as permanent default: op factions.command.power: @@ -187,5 +167,6 @@ permissions: factions.command.unclaim: description: unclaim the land where you are standing default: true - - \ No newline at end of file + factions.command.unclaimall: + description: unclaim all of your factions land + default: true \ No newline at end of file diff --git a/src/com/massivecraft/factions/Faction.java b/src/com/massivecraft/factions/Faction.java index 51c0dd70..63f19ff6 100644 --- a/src/com/massivecraft/factions/Faction.java +++ b/src/com/massivecraft/factions/Faction.java @@ -1,17 +1,13 @@ package com.massivecraft.factions; -import java.io.*; -import java.lang.reflect.Type; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.Map.Entry; -import java.util.logging.Level; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; -import com.google.gson.reflect.TypeToken; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.util.*; @@ -185,6 +181,11 @@ public class Faction extends Entity return this.getId().equals("-2"); } + public boolean isPlayerFreeType() + { + return this.isSafeZone() || this.isWarZone(); + } + // ------------------------------- // Relation and relation colors TODO @@ -302,7 +303,7 @@ public class Faction extends Entity public ArrayList getFPlayers() { ArrayList ret = new ArrayList(); - if (id < 0) return ret; + if (this.isPlayerFreeType()) return ret; for (FPlayer fplayer : FPlayers.i.get()) { @@ -318,7 +319,7 @@ public class Faction extends Entity public ArrayList getFPlayersWhereOnline(boolean online) { ArrayList ret = new ArrayList(); - if (id < 0) return ret; + if (this.isPlayerFreeType()) return ret; for (FPlayer fplayer : FPlayers.i.get()) { @@ -333,7 +334,7 @@ public class Faction extends Entity public FPlayer getFPlayerAdmin() { - if (id <= 0) return null; + if ( ! this.isNormal()) return null; for (FPlayer fplayer : FPlayers.i.get()) { @@ -347,7 +348,7 @@ public class Faction extends Entity public ArrayList getFPlayersWhereRole(Role role) { ArrayList ret = new ArrayList(); - if (id <= 0) return ret; + if ( ! this.isNormal()) return ret; for (FPlayer fplayer : FPlayers.i.get()) { if (fplayer.getFaction() == this && fplayer.getRole() == role) { @@ -361,7 +362,7 @@ public class Faction extends Entity public ArrayList getOnlinePlayers() { ArrayList ret = new ArrayList(); - if (id < 0) return ret; + if (this.isPlayerFreeType()) return ret; for (Player player: P.p.getServer().getOnlinePlayers()) { @@ -379,7 +380,7 @@ public class Faction extends Entity public boolean hasPlayersOnline() { // only real factions can have players online, not safe zone / war zone - if (id < 0) return false; + if (this.isPlayerFreeType()) return false; for (Player player: P.p.getServer().getOnlinePlayers()) { diff --git a/src/com/massivecraft/factions/P.java b/src/com/massivecraft/factions/P.java index bf168616..deddf54f 100644 --- a/src/com/massivecraft/factions/P.java +++ b/src/com/massivecraft/factions/P.java @@ -1,22 +1,12 @@ package com.massivecraft.factions; -import java.io.File; import java.lang.reflect.Modifier; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Arrays; import java.util.HashSet; -import java.util.List; -import java.util.Map; import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; import org.bukkit.block.Block; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.player.PlayerChatEvent; @@ -32,16 +22,11 @@ import com.massivecraft.factions.listeners.FactionsChatEarlyListener; import com.massivecraft.factions.listeners.FactionsEntityListener; import com.massivecraft.factions.listeners.FactionsPlayerListener; import com.massivecraft.factions.struct.ChatMode; -import com.massivecraft.factions.util.MapFLocToStringSetTypeAdapter; -import com.massivecraft.factions.util.MyLocationTypeAdapter; import com.massivecraft.factions.zcore.MPlugin; import com.nijiko.permissions.PermissionHandler; -import com.nijikokun.bukkit.Permissions.Permissions; import com.earth2me.essentials.chat.EssentialsChat; -import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.google.gson.reflect.TypeToken; import com.massivecraft.factions.integration.EssentialsFeatures; public class P extends MPlugin @@ -55,7 +40,7 @@ public class P extends MPlugin public final FactionsEntityListener entityListener; public final FactionsBlockListener blockListener; - public CmdBase cmdBase; + public FCmdRoot cmdBase; public P() { @@ -82,7 +67,7 @@ public class P extends MPlugin Board.load(); // Add Base Commands - this.cmdBase = new CmdBase(); + this.cmdBase = new FCmdRoot(); this.getBaseCommands().add(cmdBase); //setupPermissions(); @@ -96,59 +81,6 @@ public class P extends MPlugin Worldguard.init(this); } - //Type mapFLocToStringSetType = new TypeToken>>(){}.getType(); - - // Add the commands - /*commands.add(new FCommandHelp()); - commands.add(new FCommandAdmin()); - commands.add(new FCommandAutoClaim()); - commands.add(new FCommandAutoSafeclaim()); - commands.add(new FCommandAutoWarclaim()); - commands.add(new FCommandBalance()); - commands.add(new FCommandBypass()); - commands.add(new FCommandChat()); - commands.add(new FCommandClaim()); - commands.add(new FCommandConfig()); - commands.add(new FCommandCreate()); - commands.add(new FCommandDeinvite()); - commands.add(new FCommandDeposit()); - commands.add(new FCommandDescription()); - commands.add(new FCommandDisband()); - commands.add(new FCommandHome()); - commands.add(new FCommandInvite()); - commands.add(new FCommandJoin()); - commands.add(new FCommandKick()); - commands.add(new FCommandLeave()); - commands.add(new FCommandList()); - commands.add(new FCommandLock()); - commands.add(new FCommandMap()); - commands.add(new FCommandMod()); - commands.add(new FCommandNoBoom()); - commands.add(new FCommandOpen()); - commands.add(new FCommandOwner()); - commands.add(new FCommandOwnerList()); - commands.add(new FCommandPay()); - commands.add(new FCommandPower()); - commands.add(new FCommandPeaceful()); - commands.add(new FCommandPermanent()); - commands.add(new FCommandRelationAlly()); - commands.add(new FCommandRelationEnemy()); - commands.add(new FCommandRelationNeutral()); - commands.add(new FCommandReload()); - commands.add(new FCommandSafeclaim()); - commands.add(new FCommandSafeunclaimall()); - commands.add(new FCommandSaveAll()); - commands.add(new FCommandSethome()); - commands.add(new FCommandShow()); - commands.add(new FCommandTag()); - commands.add(new FCommandTitle()); - commands.add(new FCommandUnclaim()); - commands.add(new FCommandUnclaimall()); - commands.add(new FCommandVersion()); - commands.add(new FCommandWarclaim()); - commands.add(new FCommandWarunclaimall()); - commands.add(new FCommandWithdraw());*/ - // Register events PluginManager pm = this.getServer().getPluginManager(); pm.registerEvent(Event.Type.PLAYER_CHAT, this.playerListener, Event.Priority.Highest, this); @@ -177,11 +109,6 @@ public class P extends MPlugin pm.registerEvent(Event.Type.BLOCK_PISTON_EXTEND, this.blockListener, Event.Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_PISTON_RETRACT, this.blockListener, Event.Priority.Normal, this); - // Register recurring tasks - /*long saveTicks = 20 * 60 * 30; // Approximately every 30 min - if (saveTask == null) - saveTask = this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new SaveTask(), saveTicks, saveTicks); - */ postEnable(); } @@ -239,7 +166,8 @@ public class P extends MPlugin private void unhookEssentialsChat() { - if (essChat != null) { + if (essChat != null) + { EssentialsFeatures.unhookChat(); } } @@ -262,6 +190,8 @@ public class P extends MPlugin // Simply put, should this chat event be left for Factions to handle? For now, that means players with Faction Chat // enabled or use of the Factions f command without a slash; combination of isPlayerFactionChatting() and isFactionsCommand() + + public boolean shouldLetFactionsHandleThisChat(PlayerChatEvent event) { if (event == null) return false; @@ -280,10 +210,13 @@ public class P extends MPlugin } // Is this chat message actually a Factions command, and thus should be left alone by other plugins? + + // TODO: GET THIS BACK AND WORKING + public boolean isFactionsCommand(String check) { if (check == null || check.isEmpty()) return false; - return (Conf.allowNoSlashCommand && (check.startsWith(p.getBaseCommand()+" ") || check.equals(p.getBaseCommand()))); + return this.handleCommand(null, check, true); } // Get a player's faction tag (faction name), mainly for usage by chat plugins for local/channel chat diff --git a/src/com/massivecraft/factions/commands/FCommandAdmin.java b/src/com/massivecraft/factions/commands/CmdAdmin.java similarity index 95% rename from src/com/massivecraft/factions/commands/FCommandAdmin.java rename to src/com/massivecraft/factions/commands/CmdAdmin.java index 832da6a5..340a628e 100644 --- a/src/com/massivecraft/factions/commands/FCommandAdmin.java +++ b/src/com/massivecraft/factions/commands/CmdAdmin.java @@ -5,9 +5,9 @@ import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; -public class FCommandAdmin extends FCommand +public class CmdAdmin extends FCommand { - public FCommandAdmin() + public CmdAdmin() { super(); this.aliases.add("admin"); diff --git a/src/com/massivecraft/factions/commands/FCommandAutoClaim.java b/src/com/massivecraft/factions/commands/CmdAutoClaim.java similarity index 94% rename from src/com/massivecraft/factions/commands/FCommandAutoClaim.java rename to src/com/massivecraft/factions/commands/CmdAutoClaim.java index 0ca8ad37..cbb504f2 100644 --- a/src/com/massivecraft/factions/commands/FCommandAutoClaim.java +++ b/src/com/massivecraft/factions/commands/CmdAutoClaim.java @@ -4,9 +4,9 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.FLocation; import com.massivecraft.factions.struct.Permission; -public class FCommandAutoClaim extends FCommand +public class CmdAutoClaim extends FCommand { - public FCommandAutoClaim() + public CmdAutoClaim() { super(); this.aliases.add("autoclaim"); diff --git a/src/com/massivecraft/factions/commands/FCommandAutoSafeclaim.java b/src/com/massivecraft/factions/commands/CmdAutoSafeclaim.java similarity index 93% rename from src/com/massivecraft/factions/commands/FCommandAutoSafeclaim.java rename to src/com/massivecraft/factions/commands/CmdAutoSafeclaim.java index ee8db67e..dfc05ae0 100644 --- a/src/com/massivecraft/factions/commands/FCommandAutoSafeclaim.java +++ b/src/com/massivecraft/factions/commands/CmdAutoSafeclaim.java @@ -5,10 +5,10 @@ import com.massivecraft.factions.FLocation; import com.massivecraft.factions.Factions; import com.massivecraft.factions.struct.Permission; -public class FCommandAutoSafeclaim extends FCommand +public class CmdAutoSafeclaim extends FCommand { - public FCommandAutoSafeclaim() + public CmdAutoSafeclaim() { super(); this.aliases.add("autosafe"); diff --git a/src/com/massivecraft/factions/commands/FCommandAutoWarclaim.java b/src/com/massivecraft/factions/commands/CmdAutoWarclaim.java similarity index 93% rename from src/com/massivecraft/factions/commands/FCommandAutoWarclaim.java rename to src/com/massivecraft/factions/commands/CmdAutoWarclaim.java index 3a3f6a56..ff59d5f0 100644 --- a/src/com/massivecraft/factions/commands/FCommandAutoWarclaim.java +++ b/src/com/massivecraft/factions/commands/CmdAutoWarclaim.java @@ -6,10 +6,10 @@ import com.massivecraft.factions.FLocation; import com.massivecraft.factions.Factions; import com.massivecraft.factions.struct.Permission; -public class FCommandAutoWarclaim extends FCommand +public class CmdAutoWarclaim extends FCommand { - public FCommandAutoWarclaim() + public CmdAutoWarclaim() { super(); this.aliases.add("autosafe"); diff --git a/src/com/massivecraft/factions/commands/FCommandBalance.java b/src/com/massivecraft/factions/commands/CmdBalance.java similarity index 88% rename from src/com/massivecraft/factions/commands/FCommandBalance.java rename to src/com/massivecraft/factions/commands/CmdBalance.java index d0a38367..e96d1246 100644 --- a/src/com/massivecraft/factions/commands/FCommandBalance.java +++ b/src/com/massivecraft/factions/commands/CmdBalance.java @@ -5,9 +5,9 @@ import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.Faction; -public class FCommandBalance extends FCommand +public class CmdBalance extends FCommand { - public FCommandBalance() + public CmdBalance() { super(); this.aliases.add("balance"); @@ -35,7 +35,7 @@ public class FCommandBalance extends FCommand Faction faction = this.argAsFaction(0, myFaction); // TODO MAKE HIERARCHIAL COMMAND STRUCTURE HERE - if ( faction != myFaction && ! Permission.VIEW_ANY_FACTION_BALANCE.has(sender)) + if ( faction != myFaction && ! Permission.COMMAND_BALANCE_ANY.has(sender)) { sendMessageParsed("You do not have sufficient permissions to view the bank balance of other factions."); return; diff --git a/src/com/massivecraft/factions/commands/CmdBase.java b/src/com/massivecraft/factions/commands/CmdBase.java deleted file mode 100644 index b172a28f..00000000 --- a/src/com/massivecraft/factions/commands/CmdBase.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.massivecraft.factions.commands; - -import com.massivecraft.factions.Conf; - -public class CmdBase extends FCommand -{ - //public CmdAccept cmdAccept = new CmdAccept(); - - public CmdBase() - { - super(); - this.aliases.addAll(Conf.baseCommandAliases); - this.allowNoSlashAccess = Conf.allowNoSlashCommand; - - senderMustBePlayer = false; - senderMustBeMember = false; - senderMustBeModerator = false; - senderMustBeAdmin = false; - - this.setHelpShort("The faction base command"); - this.helpLong.add(p.txt.tags("This command contains all faction stuff.")); - - /*this.subCommands.add(p.cmdHelp); - this.subCommands.add(new CmdIntend()); - this.subCommands.add(new CmdInfect()); - this.subCommands.add(cmdAccept); - this.subCommands.add(new CmdList()); - this.subCommands.add(new CmdSetfood()); - this.subCommands.add(new CmdSetinfection()); - this.subCommands.add(new CmdTurn()); - this.subCommands.add(new CmdCure()); - this.subCommands.add(new CmdVersion());*/ - } - - @Override - public void perform() - { - //this.commandChain.add(this); - //p.cmdHelp.execute(this.sender, this.args, this.commandChain); - } - -} diff --git a/src/com/massivecraft/factions/commands/FCommandNoBoom.java b/src/com/massivecraft/factions/commands/CmdBoom.java similarity index 94% rename from src/com/massivecraft/factions/commands/FCommandNoBoom.java rename to src/com/massivecraft/factions/commands/CmdBoom.java index c960d190..9f1e583a 100644 --- a/src/com/massivecraft/factions/commands/FCommandNoBoom.java +++ b/src/com/massivecraft/factions/commands/CmdBoom.java @@ -3,9 +3,9 @@ package com.massivecraft.factions.commands; import com.massivecraft.factions.Conf; import com.massivecraft.factions.struct.Permission; -public class FCommandNoBoom extends FCommand +public class CmdBoom extends FCommand { - public FCommandNoBoom() + public CmdBoom() { super(); this.aliases.add("noboom"); diff --git a/src/com/massivecraft/factions/commands/FCommandBypass.java b/src/com/massivecraft/factions/commands/CmdBypass.java similarity index 93% rename from src/com/massivecraft/factions/commands/FCommandBypass.java rename to src/com/massivecraft/factions/commands/CmdBypass.java index 26d8addd..c243eba2 100644 --- a/src/com/massivecraft/factions/commands/FCommandBypass.java +++ b/src/com/massivecraft/factions/commands/CmdBypass.java @@ -3,9 +3,9 @@ package com.massivecraft.factions.commands; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; -public class FCommandBypass extends FCommand +public class CmdBypass extends FCommand { - public FCommandBypass() + public CmdBypass() { super(); this.aliases.add("bypass"); diff --git a/src/com/massivecraft/factions/commands/FCommandChat.java b/src/com/massivecraft/factions/commands/CmdChat.java similarity index 95% rename from src/com/massivecraft/factions/commands/FCommandChat.java rename to src/com/massivecraft/factions/commands/CmdChat.java index 7a8d8818..b942defe 100644 --- a/src/com/massivecraft/factions/commands/FCommandChat.java +++ b/src/com/massivecraft/factions/commands/CmdChat.java @@ -4,10 +4,10 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.struct.ChatMode; import com.massivecraft.factions.struct.Permission; -public class FCommandChat extends FCommand +public class CmdChat extends FCommand { - public FCommandChat() + public CmdChat() { super(); this.aliases.add("c"); diff --git a/src/com/massivecraft/factions/commands/FCommandClaim.java b/src/com/massivecraft/factions/commands/CmdClaim.java similarity index 89% rename from src/com/massivecraft/factions/commands/FCommandClaim.java rename to src/com/massivecraft/factions/commands/CmdClaim.java index 4c70592f..dcf462d1 100644 --- a/src/com/massivecraft/factions/commands/FCommandClaim.java +++ b/src/com/massivecraft/factions/commands/CmdClaim.java @@ -2,10 +2,10 @@ package com.massivecraft.factions.commands; import com.massivecraft.factions.struct.Permission; -public class FCommandClaim extends FCommand +public class CmdClaim extends FCommand { - public FCommandClaim() + public CmdClaim() { super(); this.aliases.add("claim"); diff --git a/src/com/massivecraft/factions/commands/FCommandConfig.java b/src/com/massivecraft/factions/commands/CmdConfig.java similarity index 94% rename from src/com/massivecraft/factions/commands/FCommandConfig.java rename to src/com/massivecraft/factions/commands/CmdConfig.java index 8d5514ae..31b0994b 100644 --- a/src/com/massivecraft/factions/commands/FCommandConfig.java +++ b/src/com/massivecraft/factions/commands/CmdConfig.java @@ -8,7 +8,6 @@ import java.util.HashMap; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.massivecraft.factions.Conf; @@ -16,11 +15,11 @@ import com.massivecraft.factions.P; import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.struct.Permission; -public class FCommandConfig extends FCommand +public class CmdConfig extends FCommand { private static HashMap properFieldNames = new HashMap(); - public FCommandConfig() + public CmdConfig() { super(); this.aliases.add("config"); @@ -86,20 +85,16 @@ public class FCommandConfig extends FCommand // boolean if (target.getType() == boolean.class) { - if (aliasTrue.contains(value.toLowerCase())) + boolean targetValue = this.strAsBool(value); + target.setBoolean(null, targetValue); + + if (targetValue) { - target.setBoolean(null, true); success = "\""+fieldName+"\" option set to true (enabled)."; } - else if (aliasFalse.contains(value.toLowerCase())) - { - target.setBoolean(null, false); - success = "\""+fieldName+"\" option set to false (disabled)."; - } else { - sendMessage("Cannot set \""+fieldName+"\": boolean value required (true or false)."); - return; + success = "\""+fieldName+"\" option set to false (disabled)."; } } diff --git a/src/com/massivecraft/factions/commands/FCommandCreate.java b/src/com/massivecraft/factions/commands/CmdCreate.java similarity index 89% rename from src/com/massivecraft/factions/commands/FCommandCreate.java rename to src/com/massivecraft/factions/commands/CmdCreate.java index c0b844f7..6bc82cb8 100644 --- a/src/com/massivecraft/factions/commands/FCommandCreate.java +++ b/src/com/massivecraft/factions/commands/CmdCreate.java @@ -11,9 +11,9 @@ import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; -public class FCommandCreate extends FCommand +public class CmdCreate extends FCommand { - public FCommandCreate() + public CmdCreate() { super(); this.aliases.add("create"); @@ -21,7 +21,7 @@ public class FCommandCreate extends FCommand this.requiredArgs.add("faction tag"); //this.optionalArgs.put("", ""); - this.permission = Permission.CREATE.node; + this.permission = Permission.COMMAND_CREATE.node; senderMustBePlayer = true; senderMustBeMember = false; @@ -75,7 +75,7 @@ public class FCommandCreate extends FCommand follower.sendMessageParsed("%s created a new faction %s", fme.getNameAndRelevant(follower), faction.getTag(follower)); } - sendMessage("You should now: " + new FCommandDescription().getUseageTemplate()); + sendMessage("You should now: " + new CmdDescription().getUseageTemplate()); } } diff --git a/src/com/massivecraft/factions/commands/FCommandDeinvite.java b/src/com/massivecraft/factions/commands/CmdDeinvite.java similarity index 86% rename from src/com/massivecraft/factions/commands/FCommandDeinvite.java rename to src/com/massivecraft/factions/commands/CmdDeinvite.java index 33527e7e..83d162ff 100644 --- a/src/com/massivecraft/factions/commands/FCommandDeinvite.java +++ b/src/com/massivecraft/factions/commands/CmdDeinvite.java @@ -3,10 +3,10 @@ package com.massivecraft.factions.commands; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.struct.Permission; -public class FCommandDeinvite extends FCommand +public class CmdDeinvite extends FCommand { - public FCommandDeinvite() + public CmdDeinvite() { super(); this.aliases.add("deinvite"); @@ -38,7 +38,7 @@ public class FCommandDeinvite extends FCommand if (you.getFaction() == myFaction) { sendMessageParsed("%s is already a member of %s", you.getName(), myFaction.getTag()); - sendMessageParsed("You might want to: %s", new FCommandKick().getUseageTemplate(false)); + sendMessageParsed("You might want to: %s", new CmdKick().getUseageTemplate(false)); return; } diff --git a/src/com/massivecraft/factions/commands/FCommandDeposit.java b/src/com/massivecraft/factions/commands/CmdDeposit.java similarity index 95% rename from src/com/massivecraft/factions/commands/FCommandDeposit.java rename to src/com/massivecraft/factions/commands/CmdDeposit.java index db3ce728..827fe955 100644 --- a/src/com/massivecraft/factions/commands/FCommandDeposit.java +++ b/src/com/massivecraft/factions/commands/CmdDeposit.java @@ -9,10 +9,10 @@ import com.massivecraft.factions.P; import com.massivecraft.factions.FPlayer; -public class FCommandDeposit extends FCommand +public class CmdDeposit extends FCommand { - public FCommandDeposit() + public CmdDeposit() { super(); this.aliases.add("deposit"); diff --git a/src/com/massivecraft/factions/commands/FCommandDescription.java b/src/com/massivecraft/factions/commands/CmdDescription.java similarity index 93% rename from src/com/massivecraft/factions/commands/FCommandDescription.java rename to src/com/massivecraft/factions/commands/CmdDescription.java index cb88392c..f720a48f 100644 --- a/src/com/massivecraft/factions/commands/FCommandDescription.java +++ b/src/com/massivecraft/factions/commands/CmdDescription.java @@ -6,9 +6,9 @@ import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TextUtil; -public class FCommandDescription extends FCommand +public class CmdDescription extends FCommand { - public FCommandDescription() + public CmdDescription() { super(); this.aliases.add("desc"); diff --git a/src/com/massivecraft/factions/commands/FCommandDisband.java b/src/com/massivecraft/factions/commands/CmdDisband.java similarity index 93% rename from src/com/massivecraft/factions/commands/FCommandDisband.java rename to src/com/massivecraft/factions/commands/CmdDisband.java index f4541905..2c4641a7 100644 --- a/src/com/massivecraft/factions/commands/FCommandDisband.java +++ b/src/com/massivecraft/factions/commands/CmdDisband.java @@ -11,9 +11,9 @@ import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; -public class FCommandDisband extends FCommand +public class CmdDisband extends FCommand { - public FCommandDisband() + public CmdDisband() { super(); this.aliases.add("disband"); diff --git a/src/com/massivecraft/factions/commands/FCommandHelp.java b/src/com/massivecraft/factions/commands/CmdHelp.java similarity index 58% rename from src/com/massivecraft/factions/commands/FCommandHelp.java rename to src/com/massivecraft/factions/commands/CmdHelp.java index a10c6e28..99b4e0bd 100644 --- a/src/com/massivecraft/factions/commands/FCommandHelp.java +++ b/src/com/massivecraft/factions/commands/CmdHelp.java @@ -8,10 +8,10 @@ import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; -public class FCommandHelp extends FCommand +public class CmdHelp extends FCommand { - public FCommandHelp() + public CmdHelp() { super(); this.aliases.add("help"); @@ -58,27 +58,27 @@ public class FCommandHelp extends FCommand ArrayList pageLines; pageLines = new ArrayList(); - pageLines.add( new FCommandHelp().getUseageTemplate() ); - pageLines.add( new FCommandList().getUseageTemplate() ); - pageLines.add( new FCommandShow().getUseageTemplate() ); - pageLines.add( new FCommandPower().getUseageTemplate() ); - pageLines.add( new FCommandJoin().getUseageTemplate() ); - pageLines.add( new FCommandLeave().getUseageTemplate() ); - pageLines.add( new FCommandChat().getUseageTemplate() ); - pageLines.add( new FCommandHome().getUseageTemplate() ); + pageLines.add( new CmdHelp().getUseageTemplate() ); + pageLines.add( new CmdList().getUseageTemplate() ); + pageLines.add( new CmdShow().getUseageTemplate() ); + pageLines.add( new CmdPower().getUseageTemplate() ); + pageLines.add( new CmdJoin().getUseageTemplate() ); + pageLines.add( new CmdLeave().getUseageTemplate() ); + pageLines.add( new CmdChat().getUseageTemplate() ); + pageLines.add( new CmdHome().getUseageTemplate() ); pageLines.add( "Learn how to create a faction on the next page." ); helpPages.add(pageLines); pageLines = new ArrayList(); - pageLines.add( new FCommandCreate().getUseageTemplate() ); - pageLines.add( new FCommandDescription().getUseageTemplate() ); - pageLines.add( new FCommandTag().getUseageTemplate() ); + pageLines.add( new CmdCreate().getUseageTemplate() ); + pageLines.add( new CmdDescription().getUseageTemplate() ); + pageLines.add( new CmdTag().getUseageTemplate() ); pageLines.add( "You might want to close it and use invitations:" ); - pageLines.add( new FCommandOpen().getUseageTemplate() ); - pageLines.add( new FCommandInvite().getUseageTemplate() ); - pageLines.add( new FCommandDeinvite().getUseageTemplate() ); + pageLines.add( new CmdOpen().getUseageTemplate() ); + pageLines.add( new CmdInvite().getUseageTemplate() ); + pageLines.add( new CmdDeinvite().getUseageTemplate() ); pageLines.add( "And don't forget to set your home:" ); - pageLines.add( new FCommandSethome().getUseageTemplate() ); + pageLines.add( new CmdSethome().getUseageTemplate() ); helpPages.add(pageLines); if (Econ.enabled() && Conf.bankEnabled) @@ -88,32 +88,32 @@ public class FCommandHelp extends FCommand pageLines.add( "Your faction has a bank which is used to pay for certain" ); pageLines.add( "things, so it will need to have money deposited into it." ); pageLines.add( "" ); - pageLines.add( new FCommandBalance().getUseageTemplate() ); - pageLines.add( new FCommandDeposit().getUseageTemplate() ); - pageLines.add( new FCommandWithdraw().getUseageTemplate() ); - pageLines.add( new FCommandPay().getUseageTemplate() ); + pageLines.add( new CmdBalance().getUseageTemplate() ); + pageLines.add( new CmdDeposit().getUseageTemplate() ); + pageLines.add( new CmdWithdraw().getUseageTemplate() ); + pageLines.add( new CmdPay().getUseageTemplate() ); pageLines.add( "" ); helpPages.add(pageLines); } pageLines = new ArrayList(); - pageLines.add( new FCommandClaim().getUseageTemplate() ); - pageLines.add( new FCommandAutoClaim().getUseageTemplate() ); - pageLines.add( new FCommandUnclaim().getUseageTemplate() ); - pageLines.add( new FCommandUnclaimall().getUseageTemplate() ); - pageLines.add( new FCommandKick().getUseageTemplate() ); - pageLines.add( new FCommandMod().getUseageTemplate() ); - pageLines.add( new FCommandAdmin().getUseageTemplate() ); - pageLines.add( new FCommandTitle().getUseageTemplate() ); + pageLines.add( new CmdClaim().getUseageTemplate() ); + pageLines.add( new CmdAutoClaim().getUseageTemplate() ); + pageLines.add( new CmdUnclaim().getUseageTemplate() ); + pageLines.add( new CmdUnclaimall().getUseageTemplate() ); + pageLines.add( new CmdKick().getUseageTemplate() ); + pageLines.add( new CmdMod().getUseageTemplate() ); + pageLines.add( new CmdAdmin().getUseageTemplate() ); + pageLines.add( new CmdTitle().getUseageTemplate() ); pageLines.add( "Player titles are just for fun. No rules connected to them." ); helpPages.add(pageLines); pageLines = new ArrayList(); - pageLines.add( new FCommandMap().getUseageTemplate() ); - pageLines.add( new FCommandNoBoom().getUseageTemplate() ); + pageLines.add( new CmdMap().getUseageTemplate() ); + pageLines.add( new CmdBoom().getUseageTemplate() ); pageLines.add(""); - pageLines.add( new FCommandOwner().getUseageTemplate() ); - pageLines.add( new FCommandOwnerList().getUseageTemplate() ); + pageLines.add( new CmdOwner().getUseageTemplate() ); + pageLines.add( new CmdOwnerList().getUseageTemplate() ); pageLines.add(""); pageLines.add("Claimed land with ownership set is further protected so"); pageLines.add("that only the owner(s), faction admin, and possibly the"); @@ -121,11 +121,11 @@ public class FCommandHelp extends FCommand helpPages.add(pageLines); pageLines = new ArrayList(); - pageLines.add( new FCommandDisband().getUseageTemplate() ); + pageLines.add( new CmdDisband().getUseageTemplate() ); pageLines.add(""); - pageLines.add( new FCommandRelationAlly().getUseageTemplate() ); - pageLines.add( new FCommandRelationNeutral().getUseageTemplate() ); - pageLines.add( new FCommandRelationEnemy().getUseageTemplate() ); + pageLines.add( new CmdRelationAlly().getUseageTemplate() ); + pageLines.add( new CmdRelationNeutral().getUseageTemplate() ); + pageLines.add( new CmdRelationEnemy().getUseageTemplate() ); pageLines.add("Set the relation you WISH to have with another faction."); pageLines.add("Your default relation with other factions will be neutral."); pageLines.add("If BOTH factions choose \"ally\" you will be allies."); @@ -158,26 +158,26 @@ public class FCommandHelp extends FCommand pageLines = new ArrayList(); pageLines.add("Finally some commands for the server admins:"); - pageLines.add( new FCommandBypass().getUseageTemplate() ); - pageLines.add( new FCommandSafeclaim().getUseageTemplate() ); - pageLines.add( new FCommandAutoSafeclaim().getUseageTemplate() ); - pageLines.add( new FCommandSafeunclaimall().getUseageTemplate() ); - pageLines.add( new FCommandWarclaim().getUseageTemplate() ); - pageLines.add( new FCommandAutoWarclaim().getUseageTemplate() ); - pageLines.add( new FCommandWarunclaimall().getUseageTemplate() ); - pageLines.add("Note: " + new FCommandUnclaim().getUseageTemplate(false) + P.p.txt.parse("") + " works on safe/war zones as well."); + pageLines.add( new CmdBypass().getUseageTemplate() ); + pageLines.add( new CmdSafeclaim().getUseageTemplate() ); + pageLines.add( new CmdAutoSafeclaim().getUseageTemplate() ); + pageLines.add( new CmdSafeunclaimall().getUseageTemplate() ); + pageLines.add( new CmdWarclaim().getUseageTemplate() ); + pageLines.add( new CmdAutoWarclaim().getUseageTemplate() ); + pageLines.add( new CmdWarunclaimall().getUseageTemplate() ); + pageLines.add("Note: " + new CmdUnclaim().getUseageTemplate(false) + P.p.txt.parse("") + " works on safe/war zones as well."); helpPages.add(pageLines); pageLines = new ArrayList(); pageLines.add("More commands for server admins:"); - pageLines.add( new FCommandPeaceful().getUseageTemplate() ); - pageLines.add( new FCommandPermanent().getUseageTemplate() ); + pageLines.add( new CmdPeaceful().getUseageTemplate() ); + pageLines.add( new CmdPermanent().getUseageTemplate() ); pageLines.add("Peaceful factions are protected from PvP and land capture."); - pageLines.add( new FCommandLock().getUseageTemplate() ); - pageLines.add( new FCommandReload().getUseageTemplate() ); - pageLines.add( new FCommandSaveAll().getUseageTemplate() ); - pageLines.add( new FCommandVersion().getUseageTemplate() ); - pageLines.add( new FCommandConfig().getUseageTemplate() ); + pageLines.add( new CmdLock().getUseageTemplate() ); + pageLines.add( new CmdReload().getUseageTemplate() ); + pageLines.add( new CmdSaveAll().getUseageTemplate() ); + pageLines.add( new CmdVersion().getUseageTemplate() ); + pageLines.add( new CmdConfig().getUseageTemplate() ); helpPages.add(pageLines); } diff --git a/src/com/massivecraft/factions/commands/FCommandHome.java b/src/com/massivecraft/factions/commands/CmdHome.java similarity index 96% rename from src/com/massivecraft/factions/commands/FCommandHome.java rename to src/com/massivecraft/factions/commands/CmdHome.java index c36afc88..dbdef81f 100644 --- a/src/com/massivecraft/factions/commands/FCommandHome.java +++ b/src/com/massivecraft/factions/commands/CmdHome.java @@ -14,10 +14,10 @@ import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Role; -public class FCommandHome extends FCommand +public class CmdHome extends FCommand { - public FCommandHome() + public CmdHome() { super(); this.aliases.add("home"); @@ -52,7 +52,7 @@ public class FCommandHome extends FCommand if ( ! myFaction.hasHome()) { fme.sendMessage("You faction does not have a home. " + (fme.getRole().value < Role.MODERATOR.value ? " Ask your leader to:" : "You should:")); - fme.sendMessage(new FCommandSethome().getUseageTemplate()); + fme.sendMessage(new CmdSethome().getUseageTemplate()); return; } diff --git a/src/com/massivecraft/factions/commands/FCommandInvite.java b/src/com/massivecraft/factions/commands/CmdInvite.java similarity index 88% rename from src/com/massivecraft/factions/commands/FCommandInvite.java rename to src/com/massivecraft/factions/commands/CmdInvite.java index 2fa8b69a..03b29f0e 100644 --- a/src/com/massivecraft/factions/commands/FCommandInvite.java +++ b/src/com/massivecraft/factions/commands/CmdInvite.java @@ -4,9 +4,9 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.struct.Permission; -public class FCommandInvite extends FCommand +public class CmdInvite extends FCommand { - public FCommandInvite() + public CmdInvite() { super(); this.aliases.add("invite"); @@ -38,7 +38,7 @@ public class FCommandInvite extends FCommand if (you.getFaction() == myFaction) { sendMessageParsed("%s is already a member of %s", you.getName(), myFaction.getTag()); - sendMessageParsed("You might want to: " + new FCommandKick().getUseageTemplate(false)); + sendMessageParsed("You might want to: " + new CmdKick().getUseageTemplate(false)); return; } diff --git a/src/com/massivecraft/factions/commands/FCommandJoin.java b/src/com/massivecraft/factions/commands/CmdJoin.java similarity index 96% rename from src/com/massivecraft/factions/commands/FCommandJoin.java rename to src/com/massivecraft/factions/commands/CmdJoin.java index c343a0b9..9e4262de 100644 --- a/src/com/massivecraft/factions/commands/FCommandJoin.java +++ b/src/com/massivecraft/factions/commands/CmdJoin.java @@ -4,9 +4,9 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.Faction; import com.massivecraft.factions.struct.Permission; -public class FCommandJoin extends FCommand +public class CmdJoin extends FCommand { - public FCommandJoin() + public CmdJoin() { super(); this.aliases.add("join"); diff --git a/src/com/massivecraft/factions/commands/FCommandKick.java b/src/com/massivecraft/factions/commands/CmdKick.java similarity index 93% rename from src/com/massivecraft/factions/commands/FCommandKick.java rename to src/com/massivecraft/factions/commands/CmdKick.java index 8bae11f2..492ce23e 100644 --- a/src/com/massivecraft/factions/commands/FCommandKick.java +++ b/src/com/massivecraft/factions/commands/CmdKick.java @@ -6,10 +6,10 @@ import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Faction; import com.massivecraft.factions.struct.Permission; -public class FCommandKick extends FCommand +public class CmdKick extends FCommand { - public FCommandKick() + public CmdKick() { super(); this.aliases.add("kick"); @@ -40,7 +40,7 @@ public class FCommandKick extends FCommand if (fme == you) { sendMessageParsed("You cannot kick yourself."); - sendMessageParsed("You might want to: %s", new FCommandLeave().getUseageTemplate(false)); + sendMessageParsed("You might want to: %s", new CmdLeave().getUseageTemplate(false)); return; } diff --git a/src/com/massivecraft/factions/commands/FCommandLeave.java b/src/com/massivecraft/factions/commands/CmdLeave.java similarity index 88% rename from src/com/massivecraft/factions/commands/FCommandLeave.java rename to src/com/massivecraft/factions/commands/CmdLeave.java index 089cd49f..62a06020 100644 --- a/src/com/massivecraft/factions/commands/FCommandLeave.java +++ b/src/com/massivecraft/factions/commands/CmdLeave.java @@ -2,9 +2,9 @@ package com.massivecraft.factions.commands; import com.massivecraft.factions.struct.Permission; -public class FCommandLeave extends FCommand { +public class CmdLeave extends FCommand { - public FCommandLeave() + public CmdLeave() { super(); this.aliases.add("leave"); diff --git a/src/com/massivecraft/factions/commands/FCommandList.java b/src/com/massivecraft/factions/commands/CmdList.java similarity index 97% rename from src/com/massivecraft/factions/commands/FCommandList.java rename to src/com/massivecraft/factions/commands/CmdList.java index 8a6ddb48..2d01eac9 100644 --- a/src/com/massivecraft/factions/commands/FCommandList.java +++ b/src/com/massivecraft/factions/commands/CmdList.java @@ -10,10 +10,10 @@ import com.massivecraft.factions.Factions; import com.massivecraft.factions.struct.Permission; -public class FCommandList extends FCommand +public class CmdList extends FCommand { - public FCommandList() + public CmdList() { super(); this.aliases.add("list"); diff --git a/src/com/massivecraft/factions/commands/FCommandLock.java b/src/com/massivecraft/factions/commands/CmdLock.java similarity index 88% rename from src/com/massivecraft/factions/commands/FCommandLock.java rename to src/com/massivecraft/factions/commands/CmdLock.java index a4883a59..628b75ae 100644 --- a/src/com/massivecraft/factions/commands/FCommandLock.java +++ b/src/com/massivecraft/factions/commands/CmdLock.java @@ -2,7 +2,7 @@ package com.massivecraft.factions.commands; import com.massivecraft.factions.struct.Permission; -public class FCommandLock extends FCommand { +public class CmdLock extends FCommand { // TODO: This solution needs refactoring. /* @@ -11,7 +11,7 @@ public class FCommandLock extends FCommand { default: op */ - public FCommandLock() + public CmdLock() { super(); this.aliases.add("lock"); diff --git a/src/com/massivecraft/factions/commands/FCommandMap.java b/src/com/massivecraft/factions/commands/CmdMap.java similarity index 95% rename from src/com/massivecraft/factions/commands/FCommandMap.java rename to src/com/massivecraft/factions/commands/CmdMap.java index 3061a6c0..6b0414f9 100644 --- a/src/com/massivecraft/factions/commands/FCommandMap.java +++ b/src/com/massivecraft/factions/commands/CmdMap.java @@ -6,9 +6,9 @@ import com.massivecraft.factions.FLocation; import com.massivecraft.factions.struct.Permission; -public class FCommandMap extends FCommand +public class CmdMap extends FCommand { - public FCommandMap() + public CmdMap() { super(); this.aliases.add("map"); diff --git a/src/com/massivecraft/factions/commands/FCommandMod.java b/src/com/massivecraft/factions/commands/CmdMod.java similarity index 95% rename from src/com/massivecraft/factions/commands/FCommandMod.java rename to src/com/massivecraft/factions/commands/CmdMod.java index 306f7515..c92adffd 100644 --- a/src/com/massivecraft/factions/commands/FCommandMod.java +++ b/src/com/massivecraft/factions/commands/CmdMod.java @@ -4,10 +4,10 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; -public class FCommandMod extends FCommand +public class CmdMod extends FCommand { - public FCommandMod() + public CmdMod() { super(); this.aliases.add("mod"); diff --git a/src/com/massivecraft/factions/commands/FCommandOpen.java b/src/com/massivecraft/factions/commands/CmdOpen.java similarity index 94% rename from src/com/massivecraft/factions/commands/FCommandOpen.java rename to src/com/massivecraft/factions/commands/CmdOpen.java index f97d55a3..167ef173 100644 --- a/src/com/massivecraft/factions/commands/FCommandOpen.java +++ b/src/com/massivecraft/factions/commands/CmdOpen.java @@ -5,9 +5,9 @@ import com.massivecraft.factions.Faction; import com.massivecraft.factions.Factions; import com.massivecraft.factions.struct.Permission; -public class FCommandOpen extends FCommand +public class CmdOpen extends FCommand { - public FCommandOpen() + public CmdOpen() { super(); this.aliases.add("open"); diff --git a/src/com/massivecraft/factions/commands/FCommandOwner.java b/src/com/massivecraft/factions/commands/CmdOwner.java similarity index 97% rename from src/com/massivecraft/factions/commands/FCommandOwner.java rename to src/com/massivecraft/factions/commands/CmdOwner.java index de310334..e5f1bc1c 100644 --- a/src/com/massivecraft/factions/commands/FCommandOwner.java +++ b/src/com/massivecraft/factions/commands/CmdOwner.java @@ -9,10 +9,10 @@ import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; -public class FCommandOwner extends FCommand +public class CmdOwner extends FCommand { - public FCommandOwner() + public CmdOwner() { super(); this.aliases.add("owner"); diff --git a/src/com/massivecraft/factions/commands/FCommandOwnerList.java b/src/com/massivecraft/factions/commands/CmdOwnerList.java similarity index 95% rename from src/com/massivecraft/factions/commands/FCommandOwnerList.java rename to src/com/massivecraft/factions/commands/CmdOwnerList.java index b3ae056f..ad72870e 100644 --- a/src/com/massivecraft/factions/commands/FCommandOwnerList.java +++ b/src/com/massivecraft/factions/commands/CmdOwnerList.java @@ -6,10 +6,10 @@ import com.massivecraft.factions.FLocation; import com.massivecraft.factions.struct.Permission; -public class FCommandOwnerList extends FCommand +public class CmdOwnerList extends FCommand { - public FCommandOwnerList() + public CmdOwnerList() { super(); this.aliases.add("ownerlist"); diff --git a/src/com/massivecraft/factions/commands/FCommandPay.java b/src/com/massivecraft/factions/commands/CmdPay.java similarity index 96% rename from src/com/massivecraft/factions/commands/FCommandPay.java rename to src/com/massivecraft/factions/commands/CmdPay.java index 00c94295..2e7913df 100644 --- a/src/com/massivecraft/factions/commands/FCommandPay.java +++ b/src/com/massivecraft/factions/commands/CmdPay.java @@ -10,9 +10,9 @@ import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; -public class FCommandPay extends FCommand +public class CmdPay extends FCommand { - public FCommandPay() + public CmdPay() { this.aliases.add("pay"); diff --git a/src/com/massivecraft/factions/commands/FCommandPeaceful.java b/src/com/massivecraft/factions/commands/CmdPeaceful.java similarity index 90% rename from src/com/massivecraft/factions/commands/FCommandPeaceful.java rename to src/com/massivecraft/factions/commands/CmdPeaceful.java index c5edf93b..177176ec 100644 --- a/src/com/massivecraft/factions/commands/FCommandPeaceful.java +++ b/src/com/massivecraft/factions/commands/CmdPeaceful.java @@ -6,10 +6,10 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.struct.Permission; -public class FCommandPeaceful extends FCommand +public class CmdPeaceful extends FCommand { - public FCommandPeaceful() + public CmdPeaceful() { super(); this.aliases.add("peaceful"); diff --git a/src/com/massivecraft/factions/commands/FCommandPermanent.java b/src/com/massivecraft/factions/commands/CmdPermanent.java similarity index 90% rename from src/com/massivecraft/factions/commands/FCommandPermanent.java rename to src/com/massivecraft/factions/commands/CmdPermanent.java index 7298b694..419d0757 100644 --- a/src/com/massivecraft/factions/commands/FCommandPermanent.java +++ b/src/com/massivecraft/factions/commands/CmdPermanent.java @@ -6,9 +6,9 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.struct.Permission; -public class FCommandPermanent extends FCommand +public class CmdPermanent extends FCommand { - public FCommandPermanent() + public CmdPermanent() { super(); this.aliases.add("permanent"); diff --git a/src/com/massivecraft/factions/commands/FCommandPower.java b/src/com/massivecraft/factions/commands/CmdPower.java similarity index 93% rename from src/com/massivecraft/factions/commands/FCommandPower.java rename to src/com/massivecraft/factions/commands/CmdPower.java index b4e9f54c..edaa049f 100644 --- a/src/com/massivecraft/factions/commands/FCommandPower.java +++ b/src/com/massivecraft/factions/commands/CmdPower.java @@ -4,10 +4,10 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.struct.Permission; -public class FCommandPower extends FCommand +public class CmdPower extends FCommand { - public FCommandPower() + public CmdPower() { super(); this.aliases.add("power"); diff --git a/src/com/massivecraft/factions/commands/FCommandRelationAlly.java b/src/com/massivecraft/factions/commands/CmdRelationAlly.java similarity index 64% rename from src/com/massivecraft/factions/commands/FCommandRelationAlly.java rename to src/com/massivecraft/factions/commands/CmdRelationAlly.java index 72f9a4b4..5cd67d8f 100644 --- a/src/com/massivecraft/factions/commands/FCommandRelationAlly.java +++ b/src/com/massivecraft/factions/commands/CmdRelationAlly.java @@ -2,9 +2,9 @@ package com.massivecraft.factions.commands; import com.massivecraft.factions.struct.Relation; -public class FCommandRelationAlly extends FRelationCommand +public class CmdRelationAlly extends FRelationCommand { - public FCommandRelationAlly() + public CmdRelationAlly() { aliases.add("ally"); targetRelation = Relation.ALLY; diff --git a/src/com/massivecraft/factions/commands/FCommandRelationEnemy.java b/src/com/massivecraft/factions/commands/CmdRelationEnemy.java similarity index 64% rename from src/com/massivecraft/factions/commands/FCommandRelationEnemy.java rename to src/com/massivecraft/factions/commands/CmdRelationEnemy.java index 37387df4..0ba25de9 100644 --- a/src/com/massivecraft/factions/commands/FCommandRelationEnemy.java +++ b/src/com/massivecraft/factions/commands/CmdRelationEnemy.java @@ -2,9 +2,9 @@ package com.massivecraft.factions.commands; import com.massivecraft.factions.struct.Relation; -public class FCommandRelationEnemy extends FRelationCommand +public class CmdRelationEnemy extends FRelationCommand { - public FCommandRelationEnemy() + public CmdRelationEnemy() { aliases.add("enemy"); targetRelation = Relation.ENEMY; diff --git a/src/com/massivecraft/factions/commands/FCommandRelationNeutral.java b/src/com/massivecraft/factions/commands/CmdRelationNeutral.java similarity index 63% rename from src/com/massivecraft/factions/commands/FCommandRelationNeutral.java rename to src/com/massivecraft/factions/commands/CmdRelationNeutral.java index 58d67629..173a0fca 100644 --- a/src/com/massivecraft/factions/commands/FCommandRelationNeutral.java +++ b/src/com/massivecraft/factions/commands/CmdRelationNeutral.java @@ -2,9 +2,9 @@ package com.massivecraft.factions.commands; import com.massivecraft.factions.struct.Relation; -public class FCommandRelationNeutral extends FRelationCommand +public class CmdRelationNeutral extends FRelationCommand { - public FCommandRelationNeutral() + public CmdRelationNeutral() { aliases.add("neutral"); targetRelation = Relation.NEUTRAL; diff --git a/src/com/massivecraft/factions/commands/FCommandReload.java b/src/com/massivecraft/factions/commands/CmdReload.java similarity index 91% rename from src/com/massivecraft/factions/commands/FCommandReload.java rename to src/com/massivecraft/factions/commands/CmdReload.java index 34344733..a2386837 100644 --- a/src/com/massivecraft/factions/commands/FCommandReload.java +++ b/src/com/massivecraft/factions/commands/CmdReload.java @@ -7,10 +7,10 @@ import com.massivecraft.factions.Factions; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; -public class FCommandReload extends FCommand +public class CmdReload extends FCommand { - public FCommandReload() + public CmdReload() { super(); this.aliases.add("reload"); diff --git a/src/com/massivecraft/factions/commands/FCommandSafeclaim.java b/src/com/massivecraft/factions/commands/CmdSafeclaim.java similarity index 91% rename from src/com/massivecraft/factions/commands/FCommandSafeclaim.java rename to src/com/massivecraft/factions/commands/CmdSafeclaim.java index b368d24e..ca501f5c 100644 --- a/src/com/massivecraft/factions/commands/FCommandSafeclaim.java +++ b/src/com/massivecraft/factions/commands/CmdSafeclaim.java @@ -5,10 +5,10 @@ import com.massivecraft.factions.FLocation; import com.massivecraft.factions.Factions; import com.massivecraft.factions.struct.Permission; -public class FCommandSafeclaim extends FCommand +public class CmdSafeclaim extends FCommand { - public FCommandSafeclaim() + public CmdSafeclaim() { this.aliases.add("safeclaim"); this.aliases.add("safe"); @@ -49,7 +49,7 @@ public class FCommandSafeclaim extends FCommand Board.setFactionAt(Factions.i.getSafeZone(), locToClaim); } - sendMessageParsed("You claimed %d chunks for the safe zone.", (1+radius*2)*(1+radius*2)); + sendMessageParsed("You claimed %d chunks for the safe zone.", (1+radius*2)*(1+radius*2)); } } diff --git a/src/com/massivecraft/factions/commands/FCommandSafeunclaimall.java b/src/com/massivecraft/factions/commands/CmdSafeunclaimall.java similarity index 90% rename from src/com/massivecraft/factions/commands/FCommandSafeunclaimall.java rename to src/com/massivecraft/factions/commands/CmdSafeunclaimall.java index 04baaac4..4deee78e 100644 --- a/src/com/massivecraft/factions/commands/FCommandSafeunclaimall.java +++ b/src/com/massivecraft/factions/commands/CmdSafeunclaimall.java @@ -4,10 +4,10 @@ import com.massivecraft.factions.Board; import com.massivecraft.factions.Factions; import com.massivecraft.factions.struct.Permission; -public class FCommandSafeunclaimall extends FCommand +public class CmdSafeunclaimall extends FCommand { - public FCommandSafeunclaimall() + public CmdSafeunclaimall() { this.aliases.add("safeunclaimall"); this.aliases.add("safedeclaimall"); diff --git a/src/com/massivecraft/factions/commands/FCommandSaveAll.java b/src/com/massivecraft/factions/commands/CmdSaveAll.java similarity index 87% rename from src/com/massivecraft/factions/commands/FCommandSaveAll.java rename to src/com/massivecraft/factions/commands/CmdSaveAll.java index 5a27a095..44f156cd 100644 --- a/src/com/massivecraft/factions/commands/FCommandSaveAll.java +++ b/src/com/massivecraft/factions/commands/CmdSaveAll.java @@ -6,10 +6,10 @@ import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Factions; import com.massivecraft.factions.struct.Permission; -public class FCommandSaveAll extends FCommand +public class CmdSaveAll extends FCommand { - public FCommandSaveAll() + public CmdSaveAll() { super(); this.aliases.add("saveall"); diff --git a/src/com/massivecraft/factions/commands/FCommandSethome.java b/src/com/massivecraft/factions/commands/CmdSethome.java similarity index 93% rename from src/com/massivecraft/factions/commands/FCommandSethome.java rename to src/com/massivecraft/factions/commands/CmdSethome.java index bbb7f321..3332f993 100644 --- a/src/com/massivecraft/factions/commands/FCommandSethome.java +++ b/src/com/massivecraft/factions/commands/CmdSethome.java @@ -7,9 +7,9 @@ import com.massivecraft.factions.Faction; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; -public class FCommandSethome extends FCommand +public class CmdSethome extends FCommand { - public FCommandSethome() + public CmdSethome() { this.aliases.add("sethome"); @@ -72,7 +72,7 @@ public class FCommandSethome extends FCommand faction.setHome(me.getLocation()); faction.sendMessage(fme.getNameAndRelevant(myFaction)+" set the home for your faction. You can now use:"); - faction.sendMessage(new FCommandHome().getUseageTemplate()); + faction.sendMessage(new CmdHome().getUseageTemplate()); if (faction != myFaction) { fme.sendMessageParsed("You have set the home for the "+faction.getTag(fme)+" faction."); diff --git a/src/com/massivecraft/factions/commands/FCommandShow.java b/src/com/massivecraft/factions/commands/CmdShow.java similarity index 98% rename from src/com/massivecraft/factions/commands/FCommandShow.java rename to src/com/massivecraft/factions/commands/CmdShow.java index b069b4d9..dc2dbe25 100644 --- a/src/com/massivecraft/factions/commands/FCommandShow.java +++ b/src/com/massivecraft/factions/commands/CmdShow.java @@ -10,10 +10,10 @@ import com.massivecraft.factions.Factions; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; -public class FCommandShow extends FCommand +public class CmdShow extends FCommand { - public FCommandShow() + public CmdShow() { this.aliases.add("show"); this.aliases.add("who"); diff --git a/src/com/massivecraft/factions/commands/FCommandTag.java b/src/com/massivecraft/factions/commands/CmdTag.java similarity index 96% rename from src/com/massivecraft/factions/commands/FCommandTag.java rename to src/com/massivecraft/factions/commands/CmdTag.java index 52c197af..7d8d02bb 100644 --- a/src/com/massivecraft/factions/commands/FCommandTag.java +++ b/src/com/massivecraft/factions/commands/CmdTag.java @@ -9,10 +9,10 @@ import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.util.MiscUtil; -public class FCommandTag extends FCommand +public class CmdTag extends FCommand { - public FCommandTag() + public CmdTag() { this.aliases.add("tag"); diff --git a/src/com/massivecraft/factions/commands/FCommandTitle.java b/src/com/massivecraft/factions/commands/CmdTitle.java similarity index 95% rename from src/com/massivecraft/factions/commands/FCommandTitle.java rename to src/com/massivecraft/factions/commands/CmdTitle.java index 05c89541..0df981a2 100644 --- a/src/com/massivecraft/factions/commands/FCommandTitle.java +++ b/src/com/massivecraft/factions/commands/CmdTitle.java @@ -6,9 +6,9 @@ import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TextUtil; -public class FCommandTitle extends FCommand +public class CmdTitle extends FCommand { - public FCommandTitle() + public CmdTitle() { this.aliases.add("title"); diff --git a/src/com/massivecraft/factions/commands/FCommandUnclaim.java b/src/com/massivecraft/factions/commands/CmdUnclaim.java similarity index 97% rename from src/com/massivecraft/factions/commands/FCommandUnclaim.java rename to src/com/massivecraft/factions/commands/CmdUnclaim.java index c00ed932..46cdb5a6 100644 --- a/src/com/massivecraft/factions/commands/FCommandUnclaim.java +++ b/src/com/massivecraft/factions/commands/CmdUnclaim.java @@ -8,9 +8,9 @@ import com.massivecraft.factions.Faction; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; -public class FCommandUnclaim extends FCommand +public class CmdUnclaim extends FCommand { - public FCommandUnclaim() + public CmdUnclaim() { this.aliases.add("unclaim"); this.aliases.add("declaim"); diff --git a/src/com/massivecraft/factions/commands/CmdUnclaimall.java b/src/com/massivecraft/factions/commands/CmdUnclaimall.java new file mode 100644 index 00000000..60794706 --- /dev/null +++ b/src/com/massivecraft/factions/commands/CmdUnclaimall.java @@ -0,0 +1,90 @@ +package com.massivecraft.factions.commands; + +import com.massivecraft.factions.Board; +import com.massivecraft.factions.Conf; +import com.massivecraft.factions.integration.Econ; +import com.massivecraft.factions.Faction; +import com.massivecraft.factions.struct.Permission; + +public class CmdUnclaimall extends FCommand +{ + public CmdUnclaimall() + { + this.aliases.add("unclaimall"); + this.aliases.add("declaimall"); + + //this.requiredArgs.add(""); + //this.optionalArgs.put("", ""); + + this.permission = Permission.COMMAND_UNCLAIM_ALL.node; + + senderMustBePlayer = true; + senderMustBeMember = false; + senderMustBeModerator = true; + senderMustBeAdmin = false; + } + + @Override + public void perform() + { + if( isLocked() ) + { + sendLockMessage(); + return; + } + + String moneyBack = ""; + if (Econ.enabled()) + { + double refund = Econ.calculateTotalLandRefund(myFaction.getLandRounded()); + // a real refund + if (refund > 0.0) + { + if(Conf.bankFactionPaysLandCosts) + { + Faction faction = myFaction; + faction.addMoney(refund); + moneyBack = " "+faction.getTag()+" received a refund of "+Econ.moneyString(refund)+"."; + } + else + { + Econ.addMoney(fme.getName(), refund); + moneyBack = " They received a refund of "+Econ.moneyString(refund)+"."; + } + } + // wait, you're charging people to unclaim land? outrageous + else if (refund < 0.0) + { + if(Conf.bankFactionPaysLandCosts) + { + Faction faction = myFaction; + if(!faction.removeMoney(-refund)) + { + sendMessageParsed("Unclaiming all faction land will cost "+Econ.moneyString(-refund)+", which your faction can't currently afford."); + return; + } + moneyBack = " It cost "+faction.getTag()+" "+Econ.moneyString(refund)+"."; + } + else + { + if (!Econ.deductMoney(fme.getName(), -refund)) + { + sendMessageParsed("Unclaiming all faction land will cost "+Econ.moneyString(-refund)+", which you can't currently afford."); + return; + } + moneyBack = " It cost them "+Econ.moneyString(refund)+"."; + } + moneyBack = " It cost them "+Econ.moneyString(refund)+"."; + } + // no refund + else + { + moneyBack = ""; + } + } + + Board.unclaimAll(myFaction.getId()); + myFaction.sendMessageParsed("%s unclaimed ALL of your faction's land."+moneyBack, fme.getNameAndRelevant(myFaction)); + } + +} diff --git a/src/com/massivecraft/factions/commands/FCommandVersion.java b/src/com/massivecraft/factions/commands/CmdVersion.java similarity index 88% rename from src/com/massivecraft/factions/commands/FCommandVersion.java rename to src/com/massivecraft/factions/commands/CmdVersion.java index 0e1ca647..e995cb01 100644 --- a/src/com/massivecraft/factions/commands/FCommandVersion.java +++ b/src/com/massivecraft/factions/commands/CmdVersion.java @@ -4,9 +4,9 @@ import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; -public class FCommandVersion extends FCommand +public class CmdVersion extends FCommand { - public FCommandVersion() + public CmdVersion() { this.aliases.add("version"); diff --git a/src/com/massivecraft/factions/commands/CmdWarclaim.java b/src/com/massivecraft/factions/commands/CmdWarclaim.java new file mode 100644 index 00000000..cd54feb9 --- /dev/null +++ b/src/com/massivecraft/factions/commands/CmdWarclaim.java @@ -0,0 +1,53 @@ +package com.massivecraft.factions.commands; + +import com.massivecraft.factions.Board; +import com.massivecraft.factions.FLocation; +import com.massivecraft.factions.Factions; +import com.massivecraft.factions.struct.Permission; + +public class CmdWarclaim extends FCommand +{ + + public CmdWarclaim() + { + this.aliases.add("warclaim"); + this.aliases.add("war"); + + //this.requiredArgs.add(""); + this.optionalArgs.put("radius", "0"); + + this.permission = Permission.MANAGE_WAR_ZONE.node; + + senderMustBePlayer = true; + senderMustBeMember = false; + senderMustBeModerator = false; + senderMustBeAdmin = false; + + this.setHelpShort("Claim land for the warzone"); + } + + public void perform() + { + if( isLocked() ) + { + sendLockMessage(); + return; + } + + // The current location of the player + FLocation playerFlocation = new FLocation(fme); + + int radius = this.argAsInt(0, 0); + if (radius < 0) radius = 0; + + FLocation from = playerFlocation.getRelative(radius, radius); + FLocation to = playerFlocation.getRelative(-radius, -radius); + + for (FLocation locToClaim : FLocation.getArea(from, to)) + { + Board.setFactionAt(Factions.i.getWarZone(), locToClaim); + } + + sendMessageParsed("You claimed %d chunks for the war zone.", (1+radius*2)*(1+radius*2)); + } +} diff --git a/src/com/massivecraft/factions/commands/CmdWarunclaimall.java b/src/com/massivecraft/factions/commands/CmdWarunclaimall.java new file mode 100644 index 00000000..08895d83 --- /dev/null +++ b/src/com/massivecraft/factions/commands/CmdWarunclaimall.java @@ -0,0 +1,42 @@ +package com.massivecraft.factions.commands; + +import com.massivecraft.factions.Board; +import com.massivecraft.factions.Factions; +import com.massivecraft.factions.struct.Permission; + +public class CmdWarunclaimall extends FCommand +{ + + public CmdWarunclaimall() + { + this.aliases.add("warunclaimall"); + this.aliases.add("wardeclaimall"); + + //this.requiredArgs.add(""); + //this.optionalArgs.put("", ""); + + this.permission = Permission.MANAGE_WAR_ZONE.node; + + senderMustBePlayer = false; + senderMustBeMember = false; + senderMustBeModerator = false; + senderMustBeAdmin = false; + + this.setHelpShort("unclaim all warzone land"); + } + + @Override + public void perform() + { + + if( isLocked() ) + { + sendLockMessage(); + return; + } + + Board.unclaimAll(Factions.i.getWarZone().getId()); + sendMessageParsed("You unclaimed ALL war zone land."); + } + +} diff --git a/src/com/massivecraft/factions/commands/FCommandWithdraw.java b/src/com/massivecraft/factions/commands/CmdWithdraw.java similarity index 96% rename from src/com/massivecraft/factions/commands/FCommandWithdraw.java rename to src/com/massivecraft/factions/commands/CmdWithdraw.java index 429b5086..ed0900ef 100644 --- a/src/com/massivecraft/factions/commands/FCommandWithdraw.java +++ b/src/com/massivecraft/factions/commands/CmdWithdraw.java @@ -10,10 +10,10 @@ import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; -public class FCommandWithdraw extends FCommand +public class CmdWithdraw extends FCommand { - public FCommandWithdraw() + public CmdWithdraw() { this.aliases.add("withdraw"); diff --git a/src/com/massivecraft/factions/commands/FCmdRoot.java b/src/com/massivecraft/factions/commands/FCmdRoot.java new file mode 100644 index 00000000..973b510e --- /dev/null +++ b/src/com/massivecraft/factions/commands/FCmdRoot.java @@ -0,0 +1,131 @@ +package com.massivecraft.factions.commands; + +import com.massivecraft.factions.Conf; + +public class FCmdRoot extends FCommand +{ + public CmdAdmin cmdAdmin = new CmdAdmin(); + public CmdAutoClaim cmdAutoClaim = new CmdAutoClaim(); + public CmdAutoSafeclaim cmdAutoSafeclaim = new CmdAutoSafeclaim(); + public CmdAutoWarclaim cmdAutoWarclaim = new CmdAutoWarclaim(); + public CmdBalance cmdBalance = new CmdBalance(); + public CmdBoom cmdBoom = new CmdBoom(); + public CmdBypass cmdBypass = new CmdBypass(); + public CmdChat cmdChat = new CmdChat(); + public CmdClaim cmdClaim = new CmdClaim(); + public CmdConfig cmdConfig = new CmdConfig(); + public CmdCreate cmdCreate = new CmdCreate(); + public CmdDeinvite cmdDeinvite = new CmdDeinvite(); + public CmdDeposit cmdDeposit = new CmdDeposit(); + public CmdDescription cmdDescription = new CmdDescription(); + public CmdDisband cmdDisband = new CmdDisband(); + public CmdHelp cmdHelp = new CmdHelp(); + public CmdHome cmdHome = new CmdHome(); + public CmdInvite cmdInvite = new CmdInvite(); + public CmdJoin cmdJoin = new CmdJoin(); + public CmdKick cmdKick = new CmdKick(); + public CmdLeave cmdLeave = new CmdLeave(); + public CmdList cmdList = new CmdList(); + public CmdLock cmdLock = new CmdLock(); + public CmdMap cmdMap = new CmdMap(); + public CmdMod cmdMod = new CmdMod(); + public CmdOpen cmdOpen = new CmdOpen(); + public CmdOwner cmdOwner = new CmdOwner(); + public CmdOwnerList cmdOwnerList = new CmdOwnerList(); + public CmdPay cmdPay = new CmdPay(); + public CmdPeaceful cmdPeaceful = new CmdPeaceful(); + public CmdPermanent cmdPermanent = new CmdPermanent(); + public CmdPower cmdPower = new CmdPower(); + public CmdRelationAlly cmdRelationAlly = new CmdRelationAlly(); + public CmdRelationEnemy cmdRelationEnemy = new CmdRelationEnemy(); + public CmdRelationNeutral cmdRelationNeutral = new CmdRelationNeutral(); + public CmdReload cmdReload = new CmdReload(); + public CmdSafeclaim cmdSafeclaim = new CmdSafeclaim(); + public CmdSafeunclaimall cmdSafeunclaimall = new CmdSafeunclaimall(); + public CmdSaveAll cmdSaveAll = new CmdSaveAll(); + public CmdSethome cmdSethome = new CmdSethome(); + public CmdShow cmdShow = new CmdShow(); + public CmdTag cmdTag = new CmdTag(); + public CmdTitle cmdTitle = new CmdTitle(); + public CmdUnclaim cmdUnclaim = new CmdUnclaim(); + public CmdUnclaimall cmdUnclaimall = new CmdUnclaimall(); + public CmdVersion cmdVersion = new CmdVersion(); + public CmdWarclaim cmdWarclaim = new CmdWarclaim(); + public CmdWarunclaimall cmdWarunclaimall = new CmdWarunclaimall(); + public CmdWithdraw cmdWithdraw = new CmdWithdraw(); + + public FCmdRoot() + { + super(); + this.aliases.addAll(Conf.baseCommandAliases); + this.allowNoSlashAccess = Conf.allowNoSlashCommand; + + senderMustBePlayer = false; + senderMustBeMember = false; + senderMustBeModerator = false; + senderMustBeAdmin = false; + + this.setHelpShort("The faction base command"); + this.helpLong.add(p.txt.tags("This command contains all faction stuff.")); + + //this.subCommands.add(p.cmdHelp); + + this.subCommands.add(this.cmdAdmin); + this.subCommands.add(this.cmdAutoClaim); + this.subCommands.add(this.cmdAutoSafeclaim); + this.subCommands.add(this.cmdAutoWarclaim); + this.subCommands.add(this.cmdBalance); + this.subCommands.add(this.cmdBoom); + this.subCommands.add(this.cmdBypass); + this.subCommands.add(this.cmdChat); + this.subCommands.add(this.cmdClaim); + this.subCommands.add(this.cmdConfig); + this.subCommands.add(this.cmdCreate); + this.subCommands.add(this.cmdDeinvite); + this.subCommands.add(this.cmdDeposit); + this.subCommands.add(this.cmdDescription); + this.subCommands.add(this.cmdDisband); + this.subCommands.add(this.cmdHelp); + this.subCommands.add(this.cmdHome); + this.subCommands.add(this.cmdInvite); + this.subCommands.add(this.cmdJoin); + this.subCommands.add(this.cmdKick); + this.subCommands.add(this.cmdLeave); + this.subCommands.add(this.cmdList); + this.subCommands.add(this.cmdLock); + this.subCommands.add(this.cmdMap); + this.subCommands.add(this.cmdMod); + this.subCommands.add(this.cmdOpen); + this.subCommands.add(this.cmdOwner); + this.subCommands.add(this.cmdOwnerList); + this.subCommands.add(this.cmdPay); + this.subCommands.add(this.cmdPeaceful); + this.subCommands.add(this.cmdPermanent); + this.subCommands.add(this.cmdPower); + this.subCommands.add(this.cmdRelationAlly); + this.subCommands.add(this.cmdRelationEnemy); + this.subCommands.add(this.cmdRelationNeutral); + this.subCommands.add(this.cmdReload); + this.subCommands.add(this.cmdSafeclaim); + this.subCommands.add(this.cmdSafeunclaimall); + this.subCommands.add(this.cmdSaveAll); + this.subCommands.add(this.cmdSethome); + this.subCommands.add(this.cmdShow); + this.subCommands.add(this.cmdTag); + this.subCommands.add(this.cmdTitle); + this.subCommands.add(this.cmdUnclaim); + this.subCommands.add(this.cmdUnclaimall); + this.subCommands.add(this.cmdVersion); + this.subCommands.add(this.cmdWarclaim); + this.subCommands.add(this.cmdWarunclaimall); + this.subCommands.add(this.cmdWithdraw); + } + + @Override + public void perform() + { + this.commandChain.add(this); + this.cmdHelp.execute(this.sender, this.args, this.commandChain); + } + +} diff --git a/src/com/massivecraft/factions/commands/FCommandUnclaimall.java b/src/com/massivecraft/factions/commands/FCommandUnclaimall.java deleted file mode 100644 index c221fb4e..00000000 --- a/src/com/massivecraft/factions/commands/FCommandUnclaimall.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.massivecraft.factions.commands; - -import com.massivecraft.factions.Board; -import com.massivecraft.factions.Conf; -import com.massivecraft.factions.integration.Econ; -import com.massivecraft.factions.Faction; -import com.massivecraft.factions.struct.Role; - -public class FCommandUnclaimall extends FCommand { - - public FCommandUnclaimall() { - aliases.add("unclaimall"); - aliases.add("declaimall"); - - helpDescription = "Unclaim all of your factions land"; - } - - @Override - public void perform() { - if ( ! assertHasFaction()) { - return; - } - - if( isLocked() ) { - sendLockMessage(); - return; - } - - if ( ! assertMinRole(Role.MODERATOR)) { - return; - } - - String moneyBack = ""; - if (Econ.enabled()) { - double refund = Econ.calculateTotalLandRefund(myFaction.getLandRounded()); - // a real refund - if (refund > 0.0) { - if(Conf.bankFactionPaysLandCosts) { - Faction faction = myFaction; - faction.addMoney(refund); - moneyBack = " "+faction.getTag()+" received a refund of "+Econ.moneyString(refund)+"."; - } else { - Econ.addMoney(fme.getName(), refund); - moneyBack = " They received a refund of "+Econ.moneyString(refund)+"."; - } - } - // wait, you're charging people to unclaim land? outrageous - else if (refund < 0.0) { - if(Conf.bankFactionPaysLandCosts) { - Faction faction = myFaction; - if(!faction.removeMoney(-refund)) { - sendMessage("Unclaiming all faction land will cost "+Econ.moneyString(-refund)+", which your faction can't currently afford."); - return; - } - moneyBack = " It cost "+faction.getTag()+" "+Econ.moneyString(refund)+"."; - } else { - if (!Econ.deductMoney(fme.getName(), -refund)) { - sendMessage("Unclaiming all faction land will cost "+Econ.moneyString(-refund)+", which you can't currently afford."); - return; - } - moneyBack = " It cost them "+Econ.moneyString(refund)+"."; - } - moneyBack = " It cost them "+Econ.moneyString(refund)+"."; - } - // no refund - else { - moneyBack = ""; - } - } - - Board.unclaimAll(myFaction.getId()); - myFaction.sendMessage(fme.getNameAndRelevant(myFaction)+Conf.colorSystem+" unclaimed ALL of your faction's land."+moneyBack); - } - -} diff --git a/src/com/massivecraft/factions/commands/FCommandWarclaim.java b/src/com/massivecraft/factions/commands/FCommandWarclaim.java deleted file mode 100644 index f7c7e275..00000000 --- a/src/com/massivecraft/factions/commands/FCommandWarclaim.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.massivecraft.factions.commands; - -import org.bukkit.command.CommandSender; - -import com.massivecraft.factions.Board; -import com.massivecraft.factions.FLocation; -import com.massivecraft.factions.Faction; -import com.massivecraft.factions.P; - -public class FCommandWarclaim extends FCommand { - - public FCommandWarclaim() { - aliases.add("warclaim"); - aliases.add("war"); - - optionalParameters.add("radius"); - - helpDescription = "Claim land for the warzone"; - } - - @Override - public boolean hasPermission(CommandSender sender) { - return P.hasPermManageWarZone(sender); - } - - public void perform() { - - if( isLocked() ) { - sendLockMessage(); - return; - } - - // The current location of the player - FLocation playerFlocation = new FLocation(fme); - - // Was a radius set? - if (parameters.size() > 0) { - int radius; - try { - radius = Integer.parseInt(parameters.get(0)); - } - catch(NumberFormatException ex) { - sendMessage("Usage: " + getUseageTemplate(false)); - sendMessage("The radius value must be an integer."); - return; - } - - FLocation from = playerFlocation.getRelative(radius, radius); - FLocation to = playerFlocation.getRelative(-radius, -radius); - - for (FLocation locToClaim : FLocation.getArea(from, to)) { - Board.setFactionAt(Faction.getWarZone(), locToClaim); - } - - sendMessage("You claimed "+(1+radius*2)*(1+radius*2)+" chunks for the war zone."); - - } else { - Board.setFactionAt(Faction.getWarZone(), playerFlocation); - sendMessage("This land is now a war zone."); - } - } - -} diff --git a/src/com/massivecraft/factions/commands/FCommandWarunclaimall.java b/src/com/massivecraft/factions/commands/FCommandWarunclaimall.java deleted file mode 100644 index fe4e051b..00000000 --- a/src/com/massivecraft/factions/commands/FCommandWarunclaimall.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.massivecraft.factions.commands; - -import org.bukkit.command.CommandSender; - -import com.massivecraft.factions.Board; -import com.massivecraft.factions.Faction; -import com.massivecraft.factions.P; - -public class FCommandWarunclaimall extends FCommand { - - public FCommandWarunclaimall() { - aliases.add("warunclaimall"); - aliases.add("wardeclaimall"); - - helpDescription = "Unclaim all warzone land"; - } - - @Override - public boolean hasPermission(CommandSender sender) { - return P.hasPermManageWarZone(sender); - } - - @Override - public void perform() { - - if( isLocked() ) { - sendLockMessage(); - return; - } - - Board.unclaimAll(Faction.getWarZone().getId()); - sendMessage("You unclaimed ALL war zone land."); - } - -} diff --git a/src/com/massivecraft/factions/integration/Econ.java b/src/com/massivecraft/factions/integration/Econ.java index 7307c393..7004d433 100644 --- a/src/com/massivecraft/factions/integration/Econ.java +++ b/src/com/massivecraft/factions/integration/Econ.java @@ -4,7 +4,7 @@ import org.bukkit.event.Event; import org.bukkit.plugin.Plugin; import com.massivecraft.factions.listeners.FactionsServerListener; -import com.massivecraft.factions.commands.FCommandHelp; +import com.massivecraft.factions.commands.CmdHelp; import com.earth2me.essentials.api.Economy; import com.nijikokun.register.payment.Methods; @@ -59,7 +59,7 @@ public class Econ { else { P.p.log("Un-hooked from Register."); } - FCommandHelp.updateHelp(); + CmdHelp.updateHelp(); } public static void iConomySet(boolean enable) @@ -71,7 +71,7 @@ public class Econ { else { P.p.log("Un-hooked from iConomy."); } - FCommandHelp.updateHelp(); + CmdHelp.updateHelp(); } public static void essentialsEcoSet(boolean enable) @@ -85,7 +85,7 @@ public class Econ { { P.p.log("Un-hooked from EssentialsEco."); } - FCommandHelp.updateHelp(); + CmdHelp.updateHelp(); } public static boolean registerHooked() diff --git a/src/com/massivecraft/factions/struct/Permission.java b/src/com/massivecraft/factions/struct/Permission.java index 5e1f304c..dafb6fc2 100644 --- a/src/com/massivecraft/factions/struct/Permission.java +++ b/src/com/massivecraft/factions/struct/Permission.java @@ -6,31 +6,20 @@ import com.massivecraft.factions.P; public enum Permission { - PARTICIPATE("participate"), - CREATE("create"), - VIEW_ANY_POWER("viewAnyPower"), - VIEW_ANY_FACTION_BALANCE("viewAnyFactionBalance"), - PEACEFUL_EXPLOTION_TOGGLE("peacefulExplosionToggle"), - CONFIG("config"), - DISBAND("disband"), - LOCK("lock"), - MANAGE_SAFE_ZONE("manageSafeZone"), - MANAGE_WAR_ZONE("manageWarZone"), - OWNERSHIP_BYPASS("ownershipBypass"), - RELOAD("reload"), - SAVE_ALL("saveall"), - SET_PEACEFUL("setPeaceful"), - SET_PERMANENT("setPermanent"), - + MANAGE_SAFE_ZONE("managesafezone"), + MANAGE_WAR_ZONE("managewarzone"), + OWNERSHIP_BYPASS("ownershipbypass"), COMMAND_ADMIN("command.admin"), - COMMAND_AUTOCLAIM("command.autoClaim"), + COMMAND_AUTOCLAIM("command.autoclaim"), COMMAND_BALANCE("command.balance"), + COMMAND_BALANCE_ANY("command.balance.any"), COMMAND_WITHDRAW("command.withdraw"), COMMAND_PAY("command.pay"), COMMAND_BYPASS("command.bypass"), COMMAND_CHAT("command.chat"), COMMAND_CLAIM("command.claim"), COMMAND_CONFIG("command.config"), + COMMAND_CREATE("command.create"), COMMAND_DEINVITE("command.deinvite"), COMMAND_DEPOSIT("command.deposit"), COMMAND_DESCRIPTION("command.description"), @@ -47,12 +36,12 @@ public enum Permission COMMAND_LOCK("command.lock"), COMMAND_MAP("command.map"), COMMAND_MOD("command.mod"), - COMMAND_NO_BOOM("command.noBoom"), + COMMAND_NO_BOOM("command.noboom"), COMMAND_OPEN("command.open"), COMMAND_OWNER("command.owner"), COMMAND_OWNERLIST("command.ownerlist"), - COMMAND_SET_PEACEFUL("command.setPeaceful"), - COMMAND_SET_PERMANENT("command.setPermanent"), + COMMAND_SET_PEACEFUL("command.setpeaceful"), + COMMAND_SET_PERMANENT("command.setpermanent"), COMMAND_POWER("command.power"), COMMAND_POWER_ANY("command.power.any"), COMMAND_RELATION("command.relation"), @@ -64,6 +53,7 @@ public enum Permission COMMAND_TAG("command.tag"), COMMAND_TITLE("command.title"), COMMAND_UNCLAIM("command.unclaim"), + COMMAND_UNCLAIM_ALL("command.unclaimall"), COMMAND_VERSION("command.version"), ; diff --git a/src/com/massivecraft/factions/zcore/MCommand.java b/src/com/massivecraft/factions/zcore/MCommand.java index 21ef83a4..269bf752 100644 --- a/src/com/massivecraft/factions/zcore/MCommand.java +++ b/src/com/massivecraft/factions/zcore/MCommand.java @@ -297,7 +297,7 @@ public abstract class MCommand // Argument Readers // -------------------------------------------- // - // Is set? + // Is set? ====================== public boolean argIsSet(int idx) { if (this.args.size() < idx+1) @@ -307,7 +307,7 @@ public abstract class MCommand return true; } - // STRING + // STRING ====================== public String argAsString(int idx, String def) { if (this.args.size() < idx+1) @@ -321,7 +321,7 @@ public abstract class MCommand return this.argAsString(idx, null); } - // INT + // INT ====================== public int argAsInt(int idx, int def) { String str = this.argAsString(idx); @@ -341,7 +341,7 @@ public abstract class MCommand return this.argAsInt(idx, -1); } - // Double + // Double ====================== public double argAsDouble(int idx, double def) { String str = this.argAsString(idx); @@ -361,12 +361,10 @@ public abstract class MCommand return this.argAsDouble(idx, -1d); } - // Boolean - public boolean argAsBool(int idx, boolean def) + // TODO: Go through the str conversion for the other arg-readers as well. + // Boolean ====================== + public Boolean strAsBool(String str) { - String str = this.argAsString(idx); - if (str == null) return def; - str = str.toLowerCase(); if (str.startsWith("y") || str.startsWith("t") || str.startsWith("on") || str.startsWith("+") || str.startsWith("1")) { @@ -374,12 +372,21 @@ public abstract class MCommand } return false; } - public boolean argAsBool(int idx) + + public Boolean argAsBool(int idx, boolean def) + { + String str = this.argAsString(idx); + if (str == null) return def; + + return strAsBool(str); + } + public Boolean argAsBool(int idx) { return this.argAsBool(idx, false); } - // PLAYER + // PLAYER ====================== + public Player argAsPlayer(int idx, Player def, boolean msg) { Player ret = def; @@ -396,8 +403,7 @@ public abstract class MCommand if (msg && ret == null) { - // TODO: Fix this injection risk! - this.sendMessage(p.txt.tags("The player \"

"+name+"\" could not be found.")); + this.sendMessageParsed("No player \"

%s\" could not be found.", name); } return ret; @@ -411,7 +417,7 @@ public abstract class MCommand return this.argAsPlayer(idx, null); } - // BEST PLAYER MATCH + // BEST PLAYER MATCH ====================== public Player argAsBestPlayerMatch(int idx, Player def, boolean msg) { Player ret = def; @@ -428,8 +434,7 @@ public abstract class MCommand if (msg && ret == null) { - // TODO: Fix this injection risk! - this.sendMessage(p.txt.tags("No player match found for \"

"+name+"\".")); + this.sendMessageParsed("No player match found for \"

%s\".", name); } return ret; diff --git a/src/com/massivecraft/factions/zcore/MPlugin.java b/src/com/massivecraft/factions/zcore/MPlugin.java index bd68f3a9..e88b62a6 100644 --- a/src/com/massivecraft/factions/zcore/MPlugin.java +++ b/src/com/massivecraft/factions/zcore/MPlugin.java @@ -193,7 +193,7 @@ public abstract class MPlugin extends JavaPlugin // COMMAND HANDLING // -------------------------------------------- // - public boolean handleCommand(CommandSender sender, String commandString) + public boolean handleCommand(CommandSender sender, String commandString, boolean testOnly) { boolean noSlash = false; if (commandString.startsWith("/")) @@ -212,6 +212,7 @@ public abstract class MPlugin extends JavaPlugin { List args = new ArrayList(Arrays.asList(commandString.split("\\s+"))); args.remove(0); + if (testOnly) return true; command.execute(sender, args); return true; } @@ -220,6 +221,11 @@ public abstract class MPlugin extends JavaPlugin return false; } + public boolean handleCommand(CommandSender sender, String commandString) + { + return this.handleCommand(sender, commandString, false); + } + // -------------------------------------------- // // HOOKS // -------------------------------------------- //