[trunk] Prevent scam (air, zero items) signs and prevent stacks size lower than 1 with /give and /item

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1087 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-04-01 23:06:44 +00:00
parent f1e44b1fda
commit 09006ced4f
3 changed files with 18 additions and 7 deletions

View file

@ -31,11 +31,13 @@ public class Commanditem extends EssentialsCommand
user.sendMessage(ChatColor.RED + "You are not allowed to spawn that item");
return;
}
if (itemArgs.length > 1)
if (itemArgs.length > 1) {
stack.setDurability(Short.parseShort(itemArgs[1]));
}
if (args.length > 1)
if (args.length > 1 && Integer.parseInt(args[1]) > 0) {
stack.setAmount(Integer.parseInt(args[1]));
}
String itemName = stack.getType().name().toLowerCase().replace('_', ' ');
user.charge(this);