summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokamosy <okamosy@gmail.com>2011-09-10 10:39:35 +0100
committerokamosy <okamosy@gmail.com>2011-09-10 10:39:35 +0100
commita2554812517d2394af6a73711e9700a17f531d69 (patch)
tree1e54e6b7b05835660997368e36ca738558e5f866
parent5b2b8dd2e3f674c22e979e0ff2590e4e8764fefa (diff)
downloadEssentials-a2554812517d2394af6a73711e9700a17f531d69.tar
Essentials-a2554812517d2394af6a73711e9700a17f531d69.tar.gz
Essentials-a2554812517d2394af6a73711e9700a17f531d69.tar.lz
Essentials-a2554812517d2394af6a73711e9700a17f531d69.tar.xz
Essentials-a2554812517d2394af6a73711e9700a17f531d69.zip
added a clearall option to powertools
-rw-r--r--Essentials/src/com/earth2me/essentials/UserData.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java11
-rw-r--r--Essentials/src/messages.properties1
-rw-r--r--Essentials/src/messages_da.properties1
-rw-r--r--Essentials/src/messages_de.properties1
-rw-r--r--Essentials/src/messages_en.properties1
-rw-r--r--Essentials/src/messages_fr.properties1
-rw-r--r--Essentials/src/messages_nl.properties1
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}.