The-Fireplace-Minecraft-Mods / Grand-Economy

A Minecraft server-side economy mod and api for hooking into various economy mods/plugins.
https://www.curseforge.com/minecraft/mc-mods/grand-economy
Mozilla Public License 2.0
4 stars 8 forks source link

Event for when balance changes #1

Closed The-Fireplace closed 4 years ago

The-Fireplace commented 4 years ago

@AustereTony-MCMods:

MC version: 1.12.2

Hello.

Grand Economy is a great option for implementing an economy for the server, and support for third-party platforms (like Sponge) is a great bonus.

I use Grand Economy to integrate third-party economies into my project (Oxygen). In my opinion, there is not enough opportunity to track a change in a player’s balance when this change occurs through Grand Economy (eg. chat commands). Could you add an event to track the player’s balance update and fire it when the balance changes inside the Grand Economy?

I need this to be able to synchronize the player’s balance with the client, if it was changed using the Grand Economy commands. At the moment, I have to use ASM transformers to implement hooks in your methods in order to track changes, which is not very convenient and not safe in case of Grand Economy update. Hooks with position: https://github.com/AustereTony-MCMods/Oxygen-Currency-Providers/blob/grand-economy/src/main/java/austeretony/oxygen_cp_ge/common/core/CurrencyProviderHooks.java

If you can add an event and provide the player's UUID, the old and new balance, it would be great.

Thank you.

The-Fireplace commented 4 years ago

Thoughts on this? https://github.com/The-Fireplace-Minecraft-Mods/Grand-Economy/commit/116fdb24df6db96107f3204b48f303dcaf62f10c

AustereTony-MCMods commented 4 years ago

Fine! I updated the provider and tested it with Grand Economy 1.3.1, the balance change event fulfills its function, thank you. When new version of Grand Economy will be released?

The-Fireplace commented 4 years ago

It is currently only available to Patrons, and will be posted to CurseForge on December 8.