From a2c43d822c66e617a84df9a8f074b9c3a3e32fae Mon Sep 17 00:00:00 2001 From: FearFree Date: Mon, 7 Apr 2014 21:23:33 -0400 Subject: [PATCH] Add amount required to notEnoughMoney TL key. See https://essentials3.atlassian.net/browse/ESS-5125 for request. --- Essentials/src/com/earth2me/essentials/Trade.java | 15 ++++++++------- Essentials/src/com/earth2me/essentials/User.java | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Trade.java b/Essentials/src/com/earth2me/essentials/Trade.java index e7426b4c4..c5298a4b1 100644 --- a/Essentials/src/com/earth2me/essentials/Trade.java +++ b/Essentials/src/com/earth2me/essentials/Trade.java @@ -3,6 +3,7 @@ package com.earth2me.essentials; import static com.earth2me.essentials.I18n.tl; import com.earth2me.essentials.craftbukkit.InventoryWorkaround; import com.earth2me.essentials.craftbukkit.SetExpFix; +import com.earth2me.essentials.utils.NumberUtil; import java.io.File; import java.io.FileWriter; import java.io.IOException; @@ -28,7 +29,7 @@ public class Trade private final transient BigDecimal money; private final transient ItemStack itemStack; private final transient Integer exp; - private final transient com.earth2me.essentials.IEssentials ess; + private final transient IEssentials ess; public enum TradeType @@ -59,7 +60,7 @@ public class Trade @Deprecated public Trade(final double money, final com.earth2me.essentials.IEssentials ess) { - this(null, null, BigDecimal.valueOf(money), null, null, ess); + this(null, null, BigDecimal.valueOf(money), null, null, (IEssentials)ess); } public Trade(final BigDecimal money, final IEssentials ess) @@ -77,7 +78,7 @@ public class Trade this(null, null, null, null, exp, ess); } - private Trade(final String command, final Trade fallback, final BigDecimal money, final ItemStack item, final Integer exp, final com.earth2me.essentials.IEssentials ess) + private Trade(final String command, final Trade fallback, final BigDecimal money, final ItemStack item, final Integer exp, final IEssentials ess) { this.command = command; this.fallbackTrade = fallback; @@ -99,7 +100,7 @@ public class Trade && getMoney().signum() > 0 && !user.canAfford(getMoney())) { - throw new ChargeException(tl("notEnoughMoney")); + throw new ChargeException(tl("notEnoughMoney", NumberUtil.displayCurrency(getMoney(), ess))); } if (getItemStack() != null @@ -113,7 +114,7 @@ public class Trade && (money = getCommandCost(user)).signum() > 0 && !user.canAfford(money)) { - throw new ChargeException(tl("notEnoughMoney")); + throw new ChargeException(tl("notEnoughMoney", NumberUtil.displayCurrency(money, ess))); } if (exp != null && exp > 0 @@ -223,7 +224,7 @@ public class Trade } if (!user.canAfford(getMoney()) && getMoney().signum() > 0) { - throw new ChargeException(tl("notEnoughMoney")); + throw new ChargeException(tl("notEnoughMoney", NumberUtil.displayCurrency(getMoney(), ess))); } user.takeMoney(getMoney()); } @@ -245,7 +246,7 @@ public class Trade final BigDecimal cost = getCommandCost(user); if (!user.canAfford(cost) && cost.signum() > 0) { - throw new ChargeException(tl("notEnoughMoney")); + throw new ChargeException(tl("notEnoughMoney", NumberUtil.displayCurrency(cost, ess))); } user.takeMoney(cost); } diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 2487fafc2..a0dc39843 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -172,7 +172,7 @@ public class User extends UserData implements Comparable, IReplyTo, net.es } else { - throw new ChargeException(tl("notEnoughMoney")); + throw new ChargeException(tl("notEnoughMoney", NumberUtil.displayCurrency(value, ess))); } }