Add a cause enum to UserBalanceUpdateEvent (#2824)

Basically, I just needed this for one of my plugins; otherwise, this could be useful for people using this event who want to see where the user's balance is being updated from.

---

* Add UserBalanceUpdateEvent.Cause
* Add special cause enum
* Add API Cause
This commit is contained in:
Josh Roy 2019-12-23 08:16:34 -05:00 committed by md678685
parent 843ecb4a42
commit 0ebd64d314
6 changed files with 52 additions and 12 deletions

View file

@ -9,6 +9,7 @@ import com.earth2me.essentials.utils.StringUtil;
import com.google.common.collect.Lists;
import net.ess3.api.MaxMoneyException;
import net.ess3.api.events.UserBalanceUpdateEvent;
import org.bukkit.Server;
import java.math.BigDecimal;
@ -73,7 +74,7 @@ public class Commandpay extends EssentialsLoopCommand {
user.getConfirmingPayments().put(player, amount);
return;
}
user.payUser(player, amount);
user.payUser(player, amount, UserBalanceUpdateEvent.Cause.COMMAND_PAY);
user.getConfirmingPayments().remove(player);
Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), player.getName(), new Trade(amount, ess), user.getLocation(), ess);
} catch (MaxMoneyException ex) {