Skip to content

Commit a2c43d8

Browse files
FearFreekhobbits
authored andcommitted
Add amount required to notEnoughMoney TL key.
See https://essentials3.atlassian.net/browse/ESS-5125 for request.
1 parent 7907565 commit a2c43d8

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Essentials/src/com/earth2me/essentials/Trade.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import static com.earth2me.essentials.I18n.tl;
44
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
55
import com.earth2me.essentials.craftbukkit.SetExpFix;
6+
import com.earth2me.essentials.utils.NumberUtil;
67
import java.io.File;
78
import java.io.FileWriter;
89
import java.io.IOException;
@@ -28,7 +29,7 @@ public class Trade
2829
private final transient BigDecimal money;
2930
private final transient ItemStack itemStack;
3031
private final transient Integer exp;
31-
private final transient com.earth2me.essentials.IEssentials ess;
32+
private final transient IEssentials ess;
3233

3334

3435
public enum TradeType
@@ -59,7 +60,7 @@ public Trade(final String command, final Trade fallback, final IEssentials ess)
5960
@Deprecated
6061
public Trade(final double money, final com.earth2me.essentials.IEssentials ess)
6162
{
62-
this(null, null, BigDecimal.valueOf(money), null, null, ess);
63+
this(null, null, BigDecimal.valueOf(money), null, null, (IEssentials)ess);
6364
}
6465

6566
public Trade(final BigDecimal money, final IEssentials ess)
@@ -77,7 +78,7 @@ public Trade(final int exp, final IEssentials ess)
7778
this(null, null, null, null, exp, ess);
7879
}
7980

80-
private Trade(final String command, final Trade fallback, final BigDecimal money, final ItemStack item, final Integer exp, final com.earth2me.essentials.IEssentials ess)
81+
private Trade(final String command, final Trade fallback, final BigDecimal money, final ItemStack item, final Integer exp, final IEssentials ess)
8182
{
8283
this.command = command;
8384
this.fallbackTrade = fallback;
@@ -99,7 +100,7 @@ public void isAffordableFor(final IUser user) throws ChargeException
99100
&& getMoney().signum() > 0
100101
&& !user.canAfford(getMoney()))
101102
{
102-
throw new ChargeException(tl("notEnoughMoney"));
103+
throw new ChargeException(tl("notEnoughMoney", NumberUtil.displayCurrency(getMoney(), ess)));
103104
}
104105

105106
if (getItemStack() != null
@@ -113,7 +114,7 @@ && getMoney().signum() > 0
113114
&& (money = getCommandCost(user)).signum() > 0
114115
&& !user.canAfford(money))
115116
{
116-
throw new ChargeException(tl("notEnoughMoney"));
117+
throw new ChargeException(tl("notEnoughMoney", NumberUtil.displayCurrency(money, ess)));
117118
}
118119

119120
if (exp != null && exp > 0
@@ -223,7 +224,7 @@ public void charge(final IUser user) throws ChargeException
223224
}
224225
if (!user.canAfford(getMoney()) && getMoney().signum() > 0)
225226
{
226-
throw new ChargeException(tl("notEnoughMoney"));
227+
throw new ChargeException(tl("notEnoughMoney", NumberUtil.displayCurrency(getMoney(), ess)));
227228
}
228229
user.takeMoney(getMoney());
229230
}
@@ -245,7 +246,7 @@ public void charge(final IUser user) throws ChargeException
245246
final BigDecimal cost = getCommandCost(user);
246247
if (!user.canAfford(cost) && cost.signum() > 0)
247248
{
248-
throw new ChargeException(tl("notEnoughMoney"));
249+
throw new ChargeException(tl("notEnoughMoney", NumberUtil.displayCurrency(cost, ess)));
249250
}
250251
user.takeMoney(cost);
251252
}

Essentials/src/com/earth2me/essentials/User.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public void payUser(final User reciever, final BigDecimal value) throws ChargeEx
172172
}
173173
else
174174
{
175-
throw new ChargeException(tl("notEnoughMoney"));
175+
throw new ChargeException(tl("notEnoughMoney", NumberUtil.displayCurrency(value, ess)));
176176
}
177177
}
178178

0 commit comments

Comments
 (0)