Add TFM_Util.isRemoveCommand

This commit is contained in:
Steven Lawson 2013-08-15 17:36:55 -04:00
parent 57efdd2269
commit 86ee0e96d2
5 changed files with 12 additions and 4 deletions

View File

@ -1,6 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
@ -121,7 +122,7 @@ public class Command_enchant extends TFM_Command
playerMsg("Can't use this enchantment on held item.");
}
}
else if (args[0].equalsIgnoreCase("remove"))
else if (TFM_Util.isRemoveCommand(args[0]))
{
itemInHand.removeEnchantment(ench);

View File

@ -1,6 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.lang.StringUtils;
import org.bukkit.command.Command;
@ -43,7 +44,7 @@ public class Command_protectarea extends TFM_Command
}
else if (args.length == 2)
{
if (args[0].equalsIgnoreCase("remove"))
if (TFM_Util.isRemoveCommand(args[0]))
{
TFM_ProtectedArea.removeProtectedArea(args[1]);

View File

@ -123,7 +123,7 @@ public class Command_saconfig extends TFM_Command
TFM_SuperadminList.addSuperadmin(admin_name);
}
}
else if (args[0].equalsIgnoreCase("delete") || args[0].equalsIgnoreCase("del") || args[0].equalsIgnoreCase("remove"))
else if (TFM_Util.isRemoveCommand(args[0]))
{
if (!TFM_SuperadminList.isSeniorAdmin(sender))
{

View File

@ -104,7 +104,7 @@ public class Command_whitelist extends TFM_Command
}
// remove
if (args[0].equalsIgnoreCase("remove"))
if (TFM_Util.isRemoveCommand(args[0]))
{
if (args.length < 2)
{

View File

@ -24,6 +24,7 @@ public class TFM_Util
private static final Map<String, Integer> eject_tracker = new HashMap<String, Integer>();
public static final Map<String, EntityType> mobtypes = new HashMap<String, EntityType>();
public static final List<String> STOP_COMMANDS = Arrays.asList("stop", "off", "end", "halt", "die");
public static final List<String> REMOVE_COMMANDS = Arrays.asList("del", "delete", "rem", "remove");
public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "DarthSalamon", "AcidicCyanide", "wild1145", "HeXeRei452", "disaster839");
static
@ -391,6 +392,11 @@ public class TFM_Util
return STOP_COMMANDS.contains(command.toLowerCase());
}
public static boolean isRemoveCommand(String command)
{
return REMOVE_COMMANDS.contains(command.toLowerCase());
}
enum EjectMethod
{
STRIKE_ONE, STRIKE_TWO, STRIKE_THREE;