diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 1c5312b17..f1a564d1a 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -444,6 +444,7 @@ public class User extends UserData implements Comparable, IReplyTo, net.es } return; } + final BigDecimal oldBalance = _getMoney(); if (Methods.hasMethod()) { try @@ -461,7 +462,7 @@ public class User extends UserData implements Comparable, IReplyTo, net.es } } super.setMoney(value, true); - ess.getServer().getPluginManager().callEvent(new UserBalanceUpdateEvent(this.getBase(), value)); + ess.getServer().getPluginManager().callEvent(new UserBalanceUpdateEvent(this.getBase(), oldBalance, value)); Trade.log("Update", "Set", "API", getName(), new Trade(value, ess), null, null, null, ess); } diff --git a/Essentials/src/net/ess3/api/events/UserBalanceUpdateEvent.java b/Essentials/src/net/ess3/api/events/UserBalanceUpdateEvent.java index 85f9f1dfc..f656388ee 100644 --- a/Essentials/src/net/ess3/api/events/UserBalanceUpdateEvent.java +++ b/Essentials/src/net/ess3/api/events/UserBalanceUpdateEvent.java @@ -11,11 +11,13 @@ public class UserBalanceUpdateEvent extends Event { private static final HandlerList handlers = new HandlerList(); private final Player player; + private final BigDecimal originalBalance; private final BigDecimal balance; - public UserBalanceUpdateEvent(Player player, BigDecimal balance) + public UserBalanceUpdateEvent(Player player, BigDecimal originalBalance, BigDecimal balance) { this.player = player; + this.originalBalance = originalBalance; this.balance = balance; } @@ -39,4 +41,9 @@ public class UserBalanceUpdateEvent extends Event { return balance; } + + public BigDecimal getOldBalance() + { + return originalBalance; + } }