Cleanup worth and sell messages

This commit is contained in:
KHobbits 2013-07-19 00:55:21 +01:00
parent 4eef8b5e84
commit 59515aed94
3 changed files with 17 additions and 4 deletions

View File

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

View File

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

View File

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