Refactor EconomyTransactionEvent
Part of the Economy API refactor.
Fix https://github.com/SpongePowered/SpongeAPI/issues/1501
EconomyTransactionEvent is now split between
Pre: is fired BEFORE the transaction has been processed (it can still fails and is cancellable). Post: is fired AFTER the transaction has been processed. This is read-only and the transaction result can be used to reliably check the result of the transaction.
Looking back at this, I missed something about EconomyTransactionEvent.Pre and getAccount. Specifically: while the method works fine for deposit/withdraw, it's unclear for transfer since that involves two accounts. Something to retrieve the other account is needed.
Do we add a method returning an Optional<Account> ? A subclass for the event ?
Input wanted.
Would it be better to just have an event that can handle multiple transactions at once? Rather than having a getAccount() and getCurrency() etc., have a collection of ProposedTransactions (or whatever) that contains this info, each one being a simple deposit or withdraw That way, a transfer is one event and the same event, and a plugin listening to this can treat/use it the same way as other plugins.
This could also allow economy plugins to build a complex web of transactions that might happen - a currency exchange plugin might allow two players to exchange their currencies so you might have two deposits and two withdrawals that all depend on each other (two accounts, two currencies, deposit and withdrawal on each side).
I've shifted the base branch here to API-9, but is this something we want to revisit, or are we better off closing and thinking about Economy in a wider sense?