added a clearall option to powertools

This commit is contained in:
okamosy 2011-09-10 10:39:35 +01:00
parent 8d6e3e7c18
commit d2bf35dac2
8 changed files with 22 additions and 1 deletions

View file

@ -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());

View file

@ -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())
{

View file

@ -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}.

View file

@ -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}.

View file

@ -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}.

View file

@ -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}.

View file

@ -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}.

View file

@ -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}.