Skip to content

Vault services providers (Economy/Permissions) aren't properly accessed #409

Open

Description

@Phoenix616

Description

When starting the server it is possible that the accessed service providing plugins (e.g. for Vault's Economy or Permissions) are loader after Guilds.

Expected Behavior

It to enable properly.

Actual Behavior

Fails to enable (and prints database error on subsequent disable):

[15:28:24] [Server thread/INFO]: [Guilds] Enabling Guilds v3.5.5.6
[15:28:24] [Server thread/INFO]:   ________ 
[15:28:24] [Server thread/INFO]:  /  _____/ 
[15:28:24] [Server thread/INFO]: /   \  ___   Guilds v3.5.5.6
[15:28:24] [Server thread/INFO]: \    \_\  \  Server Version: git-Spigot-f011ca2-3af81c7 (MC: 1.16.4)
[15:28:24] [Server thread/INFO]:  \______  /
[15:28:24] [Server thread/INFO]:         \/ 
[15:28:24] [Server thread/WARN]: It looks like you don't have an Economy plugin on your server! Stopping plugin..
[15:28:24] [Server thread/INFO]: [Guilds] Disabling Guilds v3.5.5.6
[15:28:24] [Server thread/INFO]: Shutting down database...
[15:28:24] [Server thread/ERROR]: Error occurred while disabling Guilds v3.5.5.6 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "me.glaremasters.guilds.database.DatabaseAdapter.close()" because "this.database" is null
	at me.glaremasters.guilds.Guilds.onDisable(Guilds.java:114) ~[?:?]
	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:265) ~[spigot.jar:git-Spigot-f011ca2-3af81c7]
	at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:376) ~[spigot.jar:git-Spigot-f011ca2-3af81c7]
	at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:501) ~[spigot.jar:git-Spigot-f011ca2-3af81c7]
	at me.glaremasters.guilds.Guilds.onEnable(Guilds.java:160) ~[?:?]
	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[spigot.jar:git-Spigot-f011ca2-3af81c7]
	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:351) ~[spigot.jar:git-Spigot-f011ca2-3af81c7]
	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot.jar:git-Spigot-f011ca2-3af81c7]
	at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:494) ~[spigot.jar:git-Spigot-f011ca2-3af81c7]
	at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:408) ~[spigot.jar:git-Spigot-f011ca2-3af81c7]
	at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:435) ~[spigot.jar:git-Spigot-f011ca2-3af81c7]
	at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:218) ~[spigot.jar:git-Spigot-f011ca2-3af81c7]
	at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:808) ~[spigot.jar:git-Spigot-f011ca2-3af81c7]
	at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[spigot.jar:git-Spigot-f011ca2-3af81c7]
	at java.lang.Thread.run(Thread.java:832) [?:?]

Possible Fix

Properly hook into the Economy service provider by using the service register and unregister events. (See how ChestShop does it)

Steps to Reproduce

  1. Install Vault, FakeEconomy plugin and Guilds
  2. Start server
  3. Hope that the plugin load order somehow ends up with the correct order to cause the bug
  4. Done

Context

Your Environment

  • Guilds version: Guilds v3.5.5.6
  • MC Version: git-Spigot-f011ca2-3af81c7 (MC: 1.16.4)
  • Plugin List: RedstoneClockDetector, ServerClustersBukkit, ShowItem, ServerListPlus, Vault, NamechangeSimulator, Pipes, Multiverse-Core, Testplugin, Guilds, FakeEconomy, Multiverse-NetherPortals, LWC, ChestShop, ChestShopNotifier

Activity

  1. darbyjack commented on Oct 1, 2026

    @darbyjack
    Member

    Thanks for the write-up, and for suggesting a fix. Listening for Vault's service registration is still a good idea.

    Some good news first. The messy part in your log is gone. Guilds no longer throws on the way down when it never finished starting up, and a failed startup logs the original error instead of only a generic line.

    The load order half is still there though. Guilds looks up the Vault economy and permissions providers once while it enables, and if the plugin providing them hasn't registered yet, Guilds prints a warning and switches itself off. There's no retry and no re-hook, so it stays off until the next restart. Vault itself is a soft dependency, so it's always ready first; the economy and permissions plugins aren't in that list, and that's where the ordering trouble comes from.

    Adding your provider to that list, or hooking when its service registration arrives, would close this off. Happy to test either if you or someone else wants to take it on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions