bergerhealer / MyWorlds

Cross-world teleportations and world managing commands
MIT License
51 stars 6 forks source link

Circular plugin load dependency (CMI, SuperiorSkyBlock2) #51

Closed blablubbabc closed 1 year ago

blablubbabc commented 1 year ago

A user of one of my plugins brought up this issue to me. I am pretty sure it is unrelated to my plugin, but I briefly looked into this and wanted to forward it to the relevant place:

[19:23:06 ERROR]: [SimpleProviderStorage] Circular plugin loading detected! [19:23:06 ERROR]: [SimpleProviderStorage] Circular load order: [19:23:06 ERROR]: [SimpleProviderStorage] My_Worlds -> SuperiorSkyblock2 -> CMI -> My_Worlds [19:23:06 ERROR]: [SimpleProviderStorage] Please report this to the plugin authors of the first plugin of each loop or join the PaperMC Discord server for further help. [19:23:06 ERROR]: [SimpleProviderStorage] If you would like to still load these plugins, acknowledging that there may be unexpected plugin loading issues, run the server with -Dpaper.useLegacyPluginLoading=true [19:23:06 ERROR]: Encountered an unexpected exception java.lang.IllegalStateException: Circular plugin loading from plugins My_Worlds at io.papermc.paper.plugin.storage.SimpleProviderStorage.handleCycle(SimpleProviderStorage.java:78) ~[purpur-1.20.1.jar:git-Purpur-2062] at io.papermc.paper.plugin.storage.SimpleProviderStorage.enter(SimpleProviderStorage.java:43) ~[purpur-1.20.1.jar:git-Purpur-2062] at io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enter(LaunchEntryPointHandler.java:36) ~[purpur-1.20.1.jar:git-Purpur-2062] at org.bukkit.craftbukkit.v1_20_R1.CraftServer.loadPlugins(CraftServer.java:524) ~[purpur-1.20.1.jar:git-Purpur-2062] at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:310) ~[purpur-1.20.1.jar:git-Purpur-2062] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1116) ~[purpur-1.20.1.jar:git-Purpur-2062] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:322) ~[purpur-1.20.1.jar:git-Purpur-2062] at java.lang.Thread.run(Thread.java:833) ~[?:?]

You recently added CMI to the loadbefore (https://github.com/bergerhealer/MyWorlds/commit/dbb7af44a681c70afdf52dafcb9c47bd61b4dc0c), but also list "SuperiorSkyblock2" in your softdepend, which itself lists CMI in their softdepend (https://github.com/BG-Software-LLC/SuperiorSkyblock2/blob/master/src/main/resources/plugin.yml). I don't think this can work.

bergerkiller commented 1 year ago

Ah so that explains the weird issues some people had. The problem is, there was a reason and need to loadbefore for CMI to work, so I dont know what a good way around this is now. Thats why I have a classdepend feature btw, its so I can make use of other plugins APIs without altering the dependency load order.

CMI wants worlds to have been loaded before it starts, so idk if superiorskyblock can really softdepend on cmi. Since that conflicts with that intention. Im fairly sure CMI also, itself, soft-depends on multiverse. Since they didnt softdepend on myworlds and their support is....special, I opted to add a loadbefore on my end.

Ideally superiorskyblock does a class-depend instead of softdepend, issue is, the hacks needed to achieve this for Spigot are pretty complicated to set up. On paper this is natively supported with paper-plugin.yml dependencies format.

Best would be if superiorskyblock devs could opt to include a paper-plugin.yml file with a dependency on cmi that doesnt alter load order. Then do some detection of cmi enabling late (PluginEnableEvent) and enable integrations lazily instead of at startup. This would at least fix the issue on Paper servers.

For this purpose I personally use a self-written SoftDependency library, like here where I use it in TrainCarts to enable/disable components that require other plugins as they enable/disable. It automatically handles everything, including the case of a dependency already being enabled when your plugin enables.

bergerkiller commented 1 year ago

Ill open an issue ticket over at SuperiorSkyBlock2 so we can coordinate

OmerBenGera commented 1 year ago

@blablubbabc Hey, please check out latest dev build of SuperiorSkyblock, let us know if the issue is fixed.

blablubbabc commented 1 year ago

I am not using either of these plugins myself, but I have forwarded this information to the user who originally reported the issue. But I have no idea if they will respond here.

OmerBenGera commented 1 year ago

I see. Anyways, from my testings it should be fixed, so @bergerkiller can close this for the time being. If it pops up again, let us know