summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/Worth.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsell.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandworth.java3
3 files changed, 5 insertions, 2 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Worth.java b/Essentials/src/com/earth2me/essentials/Worth.java
index d95f264ee..c9f6b0890 100644
--- a/Essentials/src/com/earth2me/essentials/Worth.java
+++ b/Essentials/src/com/earth2me/essentials/Worth.java
@@ -27,7 +27,7 @@ public class Worth implements IConf
result = config.getDouble("worth."+itemStack.getType().toString().toLowerCase().replace("_", ""), Double.NaN);
}
if (Double.isNaN(result)) {
- result = config.getDouble("worth-"+itemStack.getTypeId(), 0.0);
+ result = config.getDouble("worth-"+itemStack.getTypeId(), Double.NaN);
}
return result;
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java
index d651c882f..7d66284b1 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java
@@ -37,7 +37,7 @@ public class Commandsell extends EssentialsCommand
boolean stack = args.length > 1 && args[1].endsWith("s");
boolean requireStack = parent.getConfiguration().getBoolean("trade-in-stacks-" + id, false);
- if (worth < 1) {
+ if (Double.isNaN(worth)) {
throw new Exception("That item cannot be sold to the server.");
}
if (requireStack && !stack) {
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java
index aee5041c2..82a8729ee 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java
@@ -37,6 +37,9 @@ public class Commandworth extends EssentialsCommand
is.setAmount(amount);
double worth = Essentials.getWorth().getPrice(is);
+ if (Double.isNaN(worth)) {
+ throw new Exception("That item cannot be sold to the server.");
+ }
user.charge(this);
user.sendMessage("§7Stack of " + is.getType().toString().toLowerCase().replace("_", "") + " worth §c$" + (worth * amount) + "§7 (" + amount + " item(s) at $" + worth + " each)");