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
- Install Vault, FakeEconomy plugin and Guilds
- Start server
- Hope that the plugin load order somehow ends up with the correct order to cause the bug
- 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
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):
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
Context
Your Environment