Loading custom worlds breaks world functions

Hello,

I have some non-default worlds with command functions (basically extra world data that allows command-like behavior to be triggered by the /function command - this is part of vanilla Minecraft). The problem is that by the time I load the worlds, all functions have already been loaded and hence cannot be added. So, because of this idiocy, I need the custom worlds to load before the server thinks world loading is finished, in order for the functions to be registered (i.e., loading custom worlds the normal way does not load theit functions). The problem is, by moving the custom world loading to either the onLoad function or setting ‘load’ in plugin.yml to ‘STARTUP’, the custom worlds are loaded before the default world, resulting in exceptions since (for some ungodly reason) the server needs data from the default worlds to load other worlds.

So I have two questions:
1) Is it possible to make the world functions load correctly without making worlds load earlier?
2) If not, how can I make worlds load earlier without causing errors?

What I’ve tried:

  • Loading the worlds in onEnable with plugin loading set to postworld (result: the functions don’t load)
  • Loading the worlds in onLoad with plugin loading set to postworld (result: ArrayIndexOutOfBoundsException when the server tries to load the world’s advancements)
  • Loading the worlds in onEnable with plugin loading set to startup (result: the same exception)
  • Loading the worlds in onLoad with plugin loading set to startup (result: the same exception)
  • Loading the default worlds (world, world_nether, world_the_end) in onLoad and then loading the custom worlds, both with plugin loading set to startup and with postworld (result: the same exception, grrrr )

Note: While loading custom worlds, the server says that it loaded the functions, but the functions are not, in fact, loaded. I have verified that the functions are valid, as everything works fine on a vanilla server with the same world file.

1 Like

I believe that custom works through datapacks do not work well with spigot/paper atm. Support hasn’t been added for them.

1 Like