diff options
author | okamosy <okamosy@gmail.com> | 2011-09-10 10:39:35 +0100 |
---|---|---|
committer | okamosy <okamosy@gmail.com> | 2011-09-10 10:39:35 +0100 |
commit | d2bf35dac28529ad03823c749820f064ea36720c (patch) | |
tree | 80e56dfc930f8c09478017c0d4d7ddc59c3c17ac | |
parent | 8d6e3e7c18f6b292440db737f48337e093ea5073 (diff) | |
download | Essentials-d2bf35dac28529ad03823c749820f064ea36720c.tar Essentials-d2bf35dac28529ad03823c749820f064ea36720c.tar.gz Essentials-d2bf35dac28529ad03823c749820f064ea36720c.tar.lz Essentials-d2bf35dac28529ad03823c749820f064ea36720c.tar.xz Essentials-d2bf35dac28529ad03823c749820f064ea36720c.zip |
added a clearall option to powertools
-rw-r--r-- | Essentials/src/com/earth2me/essentials/UserData.java | 6 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java | 11 | ||||
-rw-r--r-- | Essentials/src/messages.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_da.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_de.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_en.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_fr.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_nl.properties | 1 |
8 files changed, 22 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index e5c7385b2..30bb7a2b8 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -240,6 +240,12 @@ public abstract class UserData extends PlayerExtension implements IConf } + public void clearAllPowertools() { + powertools.clear(); + config.setProperty("powertools", powertools); + config.save(); + } + public List<String> getPowertool(ItemStack stack) { return (List<String>)powertools.get(stack.getTypeId()); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java index b4977167f..c9e8dea58 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java @@ -19,6 +19,16 @@ public class Commandpowertool extends EssentialsCommand @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { + String command = getFinalArg(args, 0); + + // check to see if this is a clear all command + if(command != null && command.equalsIgnoreCase("clearall")) + { + user.clearAllPowertools(); + user.sendMessage(Util.i18n("powerToolClearAll")); + return; + } + final ItemStack itemStack = user.getItemInHand(); if (itemStack == null || itemStack.getType() == Material.AIR) { @@ -26,7 +36,6 @@ public class Commandpowertool extends EssentialsCommand } final String itemName = itemStack.getType().toString().toLowerCase().replaceAll("_", " "); - String command = getFinalArg(args, 0); List<String> powertools = user.getPowertool(itemStack); if (command != null && !command.isEmpty()) { diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 775113e0f..b7e215c10 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -244,6 +244,7 @@ possibleWorlds = \u00a77Possible worlds are the numbers 0 through {0}. powerToolAir = Command can''t be attached to air. powerToolAlreadySet = Command \u00a7c{0}\u00a7f is already assigned to {1}. powerToolAttach = \u00a7c{0}\u00a7f command assigned to {1}. +powerToolClearAll = All powertool commands have been cleared. powerToolList = {1} has the following commands: \u00a7c{0}\u00a7f. powerToolListEmpty = {0} has no commands assigned. powerToolNoSuchCommandAssigned = Command \u00a7c{0}\u00a7f has not been assigned to {1}. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 7c7258188..114b63f7e 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -243,6 +243,7 @@ possibleWorlds = \u00a77Mulige verdener er numrene 0 igennem {0}. powerToolAir = Kommando kan ikke blive tildelt luft. powerToolAlreadySet = Command \u00a7c{0}\u00a7f is already assigned to {1}. powerToolAttach = \u00a7c{0}\u00a7f command assigned to {1}. +powerToolClearAll = All powertool commands have been cleared. powerToolList = {1} has the following commands: \u00a7c{0}\u00a7f. powerToolListEmpty = {0} has no commands assigned. powerToolNoSuchCommandAssigned = Command \u00a7c{0}\u00a7f has not been assigned to {1}. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 047e3df51..45e6a50d2 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -243,6 +243,7 @@ possibleWorlds = \u00a77M\u00f6gliche Welten sind nummeriet von 0 bis {0}. powerToolAir = Befehl kann nicht mit Luft verbunden werden. powerToolAlreadySet = Command \u00a7c{0}\u00a7f is already assigned to {1}. powerToolAttach = \u00a7c{0}\u00a7f command assigned to {1}. +powerToolClearAll = All powertool commands have been cleared. powerToolList = {1} has the following commands: \u00a7c{0}\u00a7f. powerToolListEmpty = {0} has no commands assigned. powerToolNoSuchCommandAssigned = Command \u00a7c{0}\u00a7f has not been assigned to {1}. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 323228015..25064cbc7 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -243,6 +243,7 @@ possibleWorlds = \u00a77Possible worlds are the numbers 0 through {0}. powerToolAir = Command can''t be attached to air. powerToolAlreadySet = Command \u00a7c{0}\u00a7f is already assigned to {1}. powerToolAttach = \u00a7c{0}\u00a7f command assigned to {1}. +powerToolClearAll = All powertool commands have been cleared. powerToolList = {1} has the following commands: \u00a7c{0}\u00a7f. powerToolListEmpty = {0} has no commands assigned. powerToolNoSuchCommandAssigned = Command \u00a7c{0}\u00a7f has not been assigned to {1}. diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 8934ea902..a2793cdd7 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -243,6 +243,7 @@ possibleWorlds = \u00a77Les mondes possibles sont les nombres 0 par {0}. powerToolAir = La commande ne peut pas \u00eatre attach\u00e9e \u00e0 l''air. powerToolAlreadySet = Command \u00a7c{0}\u00a7f is already assigned to {1}. powerToolAttach = \u00a7c{0}\u00a7f command assigned to {1}. +powerToolClearAll = All powertool commands have been cleared. powerToolList = {1} has the following commands: \u00a7c{0}\u00a7f. powerToolListEmpty = {0} has no commands assigned. powerToolNoSuchCommandAssigned = Command \u00a7c{0}\u00a7f has not been assigned to {1}. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 72478567f..4c96d800e 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -243,6 +243,7 @@ possibleWorlds = \u00a77Mogelijk zijn de werelden de nummer 0 tot en met {0}. powerToolAir = Command kan niet worden bevestigd aan lucht. powerToolAlreadySet = Command \u00a7c{0}\u00a7f is already assigned to {1}. powerToolAttach = \u00a7c{0}\u00a7f command assigned to {1}. +powerToolClearAll = All powertool commands have been cleared. powerToolList = {1} has the following commands: \u00a7c{0}\u00a7f. powerToolListEmpty = {0} has no commands assigned. powerToolNoSuchCommandAssigned = Command \u00a7c{0}\u00a7f has not been assigned to {1}. |