diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-03-28 15:03:45 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-03-28 15:03:45 +0100 |
commit | dcacf3a7fb5fd4498d66960ebc897efde8c6f6f4 (patch) | |
tree | bdfee89e523630df87e8a28855a8b8d49c9ef6b8 | |
parent | 897d721880cb3a056a35c7488eaad53b7b09894c (diff) | |
parent | 10acb7247b5eb09473f3f481d3360a8728043b76 (diff) | |
download | Essentials-dcacf3a7fb5fd4498d66960ebc897efde8c6f6f4.tar Essentials-dcacf3a7fb5fd4498d66960ebc897efde8c6f6f4.tar.gz Essentials-dcacf3a7fb5fd4498d66960ebc897efde8c6f6f4.tar.lz Essentials-dcacf3a7fb5fd4498d66960ebc897efde8c6f6f4.tar.xz Essentials-dcacf3a7fb5fd4498d66960ebc897efde8c6f6f4.zip |
Merge branch 'master' of github.com:essentials/Essentials
-rw-r--r-- | Essentials/src/com/earth2me/essentials/Trade.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Trade.java b/Essentials/src/com/earth2me/essentials/Trade.java index fbdc471bd..730037d9a 100644 --- a/Essentials/src/com/earth2me/essentials/Trade.java +++ b/Essentials/src/com/earth2me/essentials/Trade.java @@ -56,11 +56,9 @@ public class Trade public void isAffordableFor(final IUser user) throws ChargeException { - final double mon = user.getMoney(); if (getMoney() != null - && mon < getMoney() && getMoney() > 0 - && !user.isAuthorized("essentials.eco.loan")) + && !user.canAfford(getMoney())) { throw new ChargeException(_("notEnoughMoney")); } @@ -71,12 +69,10 @@ public class Trade throw new ChargeException(_("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " "))); } + double money; if (command != null && !command.isEmpty() - && !user.isAuthorized("essentials.nocommandcost.all") - && !user.isAuthorized("essentials.nocommandcost." + command) - && mon < ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command) - && 0 < ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command) - && !user.isAuthorized("essentials.eco.loan")) + && 0 < (money = getCommandCost(user)) + && !user.canAfford(money)) { throw new ChargeException(_("notEnoughMoney")); } |