diff options
3 files changed, 17 insertions, 4 deletions
diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java index 6a7af9b7d..b1afe4576 100644 --- a/Essentials/src/com/earth2me/essentials/ItemDb.java +++ b/Essentials/src/com/earth2me/essentials/ItemDb.java @@ -181,7 +181,12 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb { is.add(get(args[0])); } - + + if (is.isEmpty() || is.get(0).getType() == Material.AIR) + { + throw new Exception(_("itemSellAir")); + } + return is; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java index c4931c00a..61c05ce07 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java @@ -59,7 +59,7 @@ public class Commandsell extends EssentialsCommand } } } - if (count > 1 && totalWorth.signum() > 0) + if (count != 1) { if (args[0].equalsIgnoreCase("blocks")) { @@ -84,6 +84,9 @@ public class Commandsell extends EssentialsCommand if (amount <= 0) { + if (!isBulkSell) { + user.sendMessage(_("itemSold", NumberUtil.displayCurrency(BigDecimal.ZERO, ess), BigDecimal.ZERO, is.getType().toString().toLowerCase(Locale.ENGLISH), NumberUtil.displayCurrency(worth, ess))); + } return BigDecimal.ZERO; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java index bc832a44b..fa2e106f7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java @@ -56,9 +56,9 @@ public class Commandworth extends EssentialsCommand } } } - if (count > 1 && totalWorth.signum() > 0) + if (count > 1) { - if (args[0].equalsIgnoreCase("blocks")) + if (args.length > 0 && args[0].equalsIgnoreCase("blocks")) { user.sendMessage(_("totalSellableBlocks", type, NumberUtil.displayCurrency(totalWorth, ess))); } @@ -113,6 +113,11 @@ public class Commandworth extends EssentialsCommand throw new Exception(_("itemCannotBeSold")); } + if (amount < 0) + { + amount = 0; + } + BigDecimal result = worth.multiply(BigDecimal.valueOf(amount)); sender.sendMessage(is.getDurability() != 0 |