mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-31 21:48:31 +01:00
[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
This commit is contained in:
parent
a1b89ee75c
commit
8ede5aad01
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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)");
|
||||
|
Loading…
Reference in New Issue
Block a user