summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2013-07-19 00:55:21 +0100
committerKHobbits <rob@khobbits.co.uk>2013-07-19 00:55:21 +0100
commit59515aed94e2019a00e046c545662a47fe44fa85 (patch)
tree327516cada6df3a879c368b2150c15cd8a0a3a93
parent4eef8b5e84982a754d3a49507dda164ce5a4226c (diff)
downloadEssentials-59515aed94e2019a00e046c545662a47fe44fa85.tar
Essentials-59515aed94e2019a00e046c545662a47fe44fa85.tar.gz
Essentials-59515aed94e2019a00e046c545662a47fe44fa85.tar.lz
Essentials-59515aed94e2019a00e046c545662a47fe44fa85.tar.xz
Essentials-59515aed94e2019a00e046c545662a47fe44fa85.zip
Cleanup worth and sell messages
-rw-r--r--Essentials/src/com/earth2me/essentials/ItemDb.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsell.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandworth.java9
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