diff --git a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java index f5a88467c..a5dff46d7 100644 --- a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java +++ b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java @@ -136,17 +136,24 @@ public class EssentialsSign { throw new SignException(Util.i18n("invalidCharge")); } - final int quantity = Integer.parseInt(split[0]); - if (quantity <= 1) + try { - throw new SignException(Util.i18n("moreThanZero")); + final int quantity = Integer.parseInt(split[0]); + if (quantity <= 1) + { + throw new SignException(Util.i18n("moreThanZero")); + } + final String item = split[1].toLowerCase(); + if (!item.equalsIgnoreCase("times")) + { + getItemStack(item); + } + sign.setLine(index, quantity + " " + item); } - final String item = split[1].toLowerCase(); - if (!item.equalsIgnoreCase("times")) + catch (NumberFormatException ex) { - getItemStack(item); + throw new SignException(Util.i18n("invalidCharge"), ex); } - sign.setLine(index, quantity + " " + item); } } @@ -187,22 +194,29 @@ public class EssentialsSign { throw new SignException(Util.i18n("invalidCharge")); } - final int quantity = Integer.parseInt(split[0]); - if (quantity <= 1) + try { - throw new SignException(Util.i18n("moreThanZero")); + final int quantity = Integer.parseInt(split[0]); + if (quantity <= 1) + { + throw new SignException(Util.i18n("moreThanZero")); + } + final String item = split[1].toLowerCase(); + if (item.equalsIgnoreCase("times")) + { + sign.setLine(index, (quantity - 1) + " times"); + return new Charge(signName.toLowerCase() + "sign", ess); + } + else + { + final ItemStack stack = getItemStack(item); + stack.setAmount(quantity); + return new Charge(quantity, ess); + } } - final String item = split[1].toLowerCase(); - if (item.equalsIgnoreCase("times")) + catch (NumberFormatException ex) { - sign.setLine(index, (quantity - 1) + " times"); - return new Charge(signName.toLowerCase() + "sign", ess); - } - else - { - final ItemStack stack = getItemStack(item); - stack.setAmount(quantity); - return new Charge(quantity, ess); + throw new SignException(Util.i18n("invalidCharge"), ex); } } }