Merge branch 'master' of github.com:essentials/Essentials

This commit is contained in:
KHobbits 2012-03-28 15:03:45 +01:00
commit 576642a573

View File

@ -56,11 +56,9 @@ public class Trade
public void isAffordableFor(final IUser user) throws ChargeException public void isAffordableFor(final IUser user) throws ChargeException
{ {
final double mon = user.getMoney();
if (getMoney() != null if (getMoney() != null
&& mon < getMoney()
&& getMoney() > 0 && getMoney() > 0
&& !user.isAuthorized("essentials.eco.loan")) && !user.canAfford(getMoney()))
{ {
throw new ChargeException(_("notEnoughMoney")); throw new ChargeException(_("notEnoughMoney"));
} }
@ -71,12 +69,10 @@ public class Trade
throw new ChargeException(_("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " "))); throw new ChargeException(_("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " ")));
} }
double money;
if (command != null && !command.isEmpty() if (command != null && !command.isEmpty()
&& !user.isAuthorized("essentials.nocommandcost.all") && 0 < (money = getCommandCost(user))
&& !user.isAuthorized("essentials.nocommandcost." + command) && !user.canAfford(money))
&& 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"))
{ {
throw new ChargeException(_("notEnoughMoney")); throw new ChargeException(_("notEnoughMoney"));
} }