mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-17 12:01:20 +02:00
Cleanup worth and sell messages
This commit is contained in:
@@ -182,6 +182,11 @@ 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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user