Other plugins that requires MV worlds loads before MV
benwoo1110 opened this issue ยท 2 comments
I saw a few instances where Other plugins that require MV worlds loads before MV, causing unexpected errors, and I don't see an easy way to fix it (at least on mv side).
One way is to add load before
in mv, but it's not practical since there can be unknown number of plugins that have this issue. its also possible for those plugin to set mv as soft dependent
, but again not the most ideal but it doesn't work for other world management plugin.
Other way is to do those worlds stuff post startup, with ServerLoadEvent and this will need those plugin to change it behaviour.
To me, mv cant really fix this, but wanted to see if anyone has their opinions on it! ๐
I don't have an exact solution, but I can offer the following process of plugin initialization which may or may not present some opportunities for Multiverse to strategically insert itself:
- All plugins are constructed and loaded, including by calling their
onLoad
methods - Plugins with
load: STARTUP
are enabled viaonEnable
. This property must be defined in the plugin.yml - Plugins with
load: POSTWORLD
, which is the default if not specified, are enabled. - The ServerLoadEvent is fired
- So-called "delayed initialization tasks" are run; these are 0-tick delayed tasks registered with the scheduler commonly used by plugins to run operations post-initialization.
Certainly, multiverse adding load-before can be ruled out. I think other plugins adding a soft dependency can be reasonably ruled out, since that too requires explicit compatibility statements, but by world consumer plugins.
I'm not familiar with when Multiverse loads worlds and any requirements surrounding how it does so. I'd think it would not be possible to load worlds before the POSTWORLD phase of plugins being enabled.
From what I could see in my logs does MV seem to load the additional worlds (outside of the default ones defined in the server.properties) when it gets enabled, which may or may not happen after other plugins have received their onEnable
call, which could cause issues. The soft-depend
option here could perhaps prevent those issues if the plugins requiring MV would have it set, but I think that depends (no pun intended) on whether the world loading is happening in MVs onEnable and is "done" when the end of the onEnable was reached (The plugin is declared enabled).
The only way I see here to load the worlds earlier would either be through the onLoad
which Idk if that is even possible or by "hacking" into spigot using an own classLoader or something as a JavaAgent on startup, which would enable MV before anything else. That's what SlimeWorldManager and Advanced SlimeWorldManager are doing to both load worlds in the SR-Format and to also load them very early (pretty much on a level with default worlds) on server startup.
But that's again just what I experienced and know with my basic Bukkit knowledge.
The ServerLoadEvent could be an idea for most plugins, but most devs aren't even aware of it, as it has been added just recently (And md_5 does a horrible job at mentioning those things at all), so the issue here would be, that it isn't in older Bukkit/Spigot versions available, so it would require additional logic for the plugins to know, when that event is available and what else they should do if it isn't.
So in summary: The way Bukkit/Spigot's options on how to enable a plugin are made possible is very limiting for plugins that handle worlds.