MilkBowl / VaultAPI

API Component of Vault
GNU Lesser General Public License v3.0
273 stars 109 forks source link

Economy provider returns null on newer versions of Spigot, EssentialsX is installed. #119

Closed x86-39 closed 3 years ago

x86-39 commented 3 years ago

I'm using the following to get the Economy provider:
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
economy = rsp.getProvider();
This is exactly as described in the example in the readme.
I have EssentialsX installed, and this same line works on older server versions.
I'm using Tuinity to test because I have a build where this does work. Tuinity build 9bdcb9b works, this loads and returns no errors.
However, on latest Spigot, Paper and Tuinity (I tested all 3) this returns null and the plugin quits. EssentialsX is installed and on the latest version (As of writing EssentialsX-2.19.0-dev+232-b84207f). I'm sure this is not an issue with if I have EssentialsX installed, I defined Vault and Essentials as a dependency to the plugin, so these are loaded before it.
getServer().getServicesManager().getKnownServices() returns the following, proving that Vault and Essentials are loaded at that time.

[MyPlugin]: [[interface net.essentialsx.api.v2.services.BalanceTop, class net.milkbowl.vault.permission.Permission, interface net.luckperms.api.LuckPerms, interface me.lucko.spark.api.Spark, interface net.milkbowl.vault.economy.Economy, class net.milkbowl.vault.metrics.bukkit.Metrics, interface net.essentialsx.api.v2.services.mail.MailService, class net.milkbowl.vault.chat.Chat, class me.ebonjaeger.perworldinventory.metrics.bukkit.Metrics, class me.clip.placeholderapi.metrics.bukkit.Metrics, class com.comphenix.protocol.metrics.Metrics, class com.sk89q.worldguard.bukkit.bstats.bukkit.Metrics, class com.earth2me.essentials.metrics.Metrics]]

This seems to have broken somewhere during 1.16.5, as the latest Tuinity for 1.16.5 also has this issue. This issue occurs both on Java 11 and Java 16.

Sleaker commented 3 years ago

if the service manager shows vault services registered I don't really think there's anything else here to look at. This might be an issue with something that changed in the server or EssentialsX. I'd check with Essentials and make sure it's actually registering itself as an economy, perhaps it's no longer doing so?

Sleaker commented 3 years ago

closing as this is not an API issue. if you can identify the bug causing this please feel free to re-open a ticket in Milkbowl/Vault

x86-39 commented 3 years ago

Alright sounds good. I'll check with Essentials and see if anything has changed on their end during that upgrade. But since this occurs both on very old and latest I doubt it. Hopefully it's not a Vault issue but if I find it I'll open an issue there.

x86-39 commented 3 years ago

Didn't see any issues on their repository so I had a critical look and compared it to other plugins. The code was totally fine. The issue was that I packaged Vault into the plugin JAR, this was causing it to not load Essentials. This used to work on older versions of Spigot, but I guess somewhere recently this got changed and the class in the JAR would be prioritized over Essentials or something. Thanks for the help and sorry for the trouble