0527f116e2
This commit reworks how MobArena interfaces with Vault economy provider instances. Instead of affixing an Economy _instance_ to the main plugin at "setup time", we create an instance of the new _Finance_ abstraction at "(re)load time", and then use this new abstraction at every call site (really just the MoneyThing) instead of Economy. This accomplishes two important things: 1. Due to how the Bukkit load order works and how Vault providers are registered with the plugin, the Finance abstraction gives us a means of deferring the retrieval of the Economy provider needed to integrate with the underlying economy plugin (or script). MobArena still uses Finance as if it was a "complete" object and is completely unaware of what goes on under the hodd. This is a much more elegant solution compared to the terrible past proposals of fragmenting MobArena's bootstrapping phase, especially considering the past proposals were server tick-centric... 2. It creates a simple and maintainable interface between MobArena and Vault, effectively giving control back to MobArena as to how everything should mesh together. The biggest downside to this solution is that we no longer know if an economy provider is available for when we need it at a convenient time in the startup process. Instead, we need to react accordingly when an economy operation is invoked. The implementation takes a somewhat mild approach by simply _logging_ any issues encountered and defaulting to "best effort" operations when an economy provider is not available. At worst, this is a bunch of log spam and potentially a lot of work for server owners to clean up after (compensating players for rewards and stuff like that), but MobArena doesn't handle arbitrary exceptions in its join/leave and start/end procedures very well, so it's probably a better way to go about it than throwing exceptions. If the server does not have Vault installed, an UnsupportedFinance is created. This implementation just logs errors and "fails to work" on every operation. If Vault is installed, a VaultFinance is created, and this implementation should only log errors if a Vault economy provider couldn't be found. We could have opted for a single implementation, but this approach allows us to potentially support other economy registrars in the future, so we (probably) won't have to make sweeping changes in order to swap to something else. Closes #797 |
||
---|---|---|
.github | ||
gradle/wrapper | ||
scripts | ||
src | ||
.gitignore | ||
build.gradle.kts | ||
changelog.md | ||
gradlew | ||
gradlew.bat | ||
LICENSE | ||
README.md | ||
settings.gradle.kts |
MobArena
MobArena is an arena-style minigame for Spigot-based Minecraft servers
Getting Started
If you don't want to compile the plugin yourself, grab a release artifact from one of these two sites:
The wiki here on Github should have all the information you need to get started using the plugin.
Getting Help
If you run into problems or need help with something, feel free to hop on the MobArena Discord server to have a chat: Instant Invite
Remember, though, that this communication channel is idle chat, which means you likely won't get a response immediately. It could take anything from a couple of seconds to a day, but your message will be seen.
Contributing
Found a bug, got a suggestion, or want to dig into the code base? There are many ways to contribute to the project!
Get started here: Contributing