summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-16 15:25:48 +0000
committersnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-16 15:25:48 +0000
commit8ede5aad0185e2411fb762e4b62bdda5c56557ac (patch)
tree5a197dbe278021ae9503421bc0ce4adb14ad4c0e
parenta1b89ee75c5d61169c84a51c5b1af6e5e4e95b17 (diff)
downloadEssentials-8ede5aad0185e2411fb762e4b62bdda5c56557ac.tar
Essentials-8ede5aad0185e2411fb762e4b62bdda5c56557ac.tar.gz
Essentials-8ede5aad0185e2411fb762e4b62bdda5c56557ac.tar.lz
Essentials-8ede5aad0185e2411fb762e4b62bdda5c56557ac.tar.xz
Essentials-8ede5aad0185e2411fb762e4b62bdda5c56557ac.zip
[trunk] Worth: Don't default to 0.0, default to NaN.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1225 e251c2fe-e539-e718-e476-b85c1f46cddb
-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)");