diff options
author | KHobbits <rob@khobbits.co.uk> | 2013-09-04 06:35:53 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2013-09-04 06:35:53 +0100 |
commit | c056ba005925cfb917756e91084c20acc21f3df2 (patch) | |
tree | 129c75f864699686e2ae13a44570d6ec1b007c65 | |
parent | df5d9a4db8ce5994d948a3ee0b52759a1daa8830 (diff) | |
download | Essentials-c056ba005925cfb917756e91084c20acc21f3df2.tar Essentials-c056ba005925cfb917756e91084c20acc21f3df2.tar.gz Essentials-c056ba005925cfb917756e91084c20acc21f3df2.tar.lz Essentials-c056ba005925cfb917756e91084c20acc21f3df2.tar.xz Essentials-c056ba005925cfb917756e91084c20acc21f3df2.zip |
Properly handle negative /clear amounts.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java index 9119b1696..1d4d82dcf 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java @@ -62,7 +62,7 @@ public class Commandclearinventory extends EssentialsCommand } for (Player player : players) { - clearHandler(sender, player, args, offset, players.size() < EXTENDED_CAP); + clearHandler(sender, player, args, offset, players.size() < EXTENDED_CAP); } } @@ -121,7 +121,8 @@ public class Commandclearinventory extends EssentialsCommand if (data == -1) // data -1 means that all subtypes will be cleared { ItemStack stack = new ItemStack(type); - if (showExtended) { + if (showExtended) + { sender.sendMessage(_("inventoryClearingAllStack", stack.getType().toString().toLowerCase(Locale.ENGLISH), player.getDisplayName())); } player.getInventory().clear(type, data); @@ -138,6 +139,10 @@ public class Commandclearinventory extends EssentialsCommand } else { + if (amount < 0) + { + amount = 1; + } ItemStack stack = new ItemStack(type, amount, data); if (player.getInventory().containsAtLeast(stack, amount)) { |