mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-14 13:13:24 +00:00
Don't charge if the cost is 0.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1531 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
parent
1f02f6fac8
commit
6b65c5cc83
1 changed files with 9 additions and 6 deletions
|
@ -66,7 +66,7 @@ public class Charge
|
||||||
public void charge(User user) throws Exception
|
public void charge(User user) throws Exception
|
||||||
{
|
{
|
||||||
double mon = user.getMoney();
|
double mon = user.getMoney();
|
||||||
if (costs != null)
|
if (costs != null && costs != 0.0)
|
||||||
{
|
{
|
||||||
if (mon < costs && !user.isAuthorized("essentials.eco.loan"))
|
if (mon < costs && !user.isAuthorized("essentials.eco.loan"))
|
||||||
{
|
{
|
||||||
|
@ -92,13 +92,16 @@ public class Charge
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double cost = ess.getSettings().getCommandCost(command.startsWith("/") ? command.substring(1) : command);
|
int cost = ess.getSettings().getCommandCost(command.startsWith("/") ? command.substring(1) : command);
|
||||||
if (mon < cost && !user.isAuthorized("essentials.eco.loan"))
|
if (cost != 0)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("notEnoughMoney"));
|
if (mon < cost && !user.isAuthorized("essentials.eco.loan"))
|
||||||
|
{
|
||||||
|
throw new Exception(Util.i18n("notEnoughMoney"));
|
||||||
|
}
|
||||||
|
user.takeMoney(cost);
|
||||||
|
user.sendMessage(Util.format("moneyTaken", Util.formatCurrency(cost)));
|
||||||
}
|
}
|
||||||
user.takeMoney(cost);
|
|
||||||
user.sendMessage(Util.format("moneyTaken", Util.formatCurrency(cost)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue