33import static com .earth2me .essentials .I18n .tl ;
44import com .earth2me .essentials .craftbukkit .InventoryWorkaround ;
55import com .earth2me .essentials .craftbukkit .SetExpFix ;
6+ import com .earth2me .essentials .utils .NumberUtil ;
67import java .io .File ;
78import java .io .FileWriter ;
89import 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 }
0 commit comments