Execute something when all worlds are loaded

Discussion in 'Plugin Development' started by matejdro, Feb 24, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    matejdro

    When executing stuff in onEnable(), there may be or may be not other worlds loaded, because they are loaded by plugin which may be loaded before or after your plugin. And if they are loaded after your plugin, you won't detect them.

    Is there a way to run something after all plugins are loaded, so all worlds are also loaded?
     
  2. Offline

    Raphfrk

    What you want is a second enable method that is called after the first one.

    I am not sure what the ordering is. Maybe if you call your plugin Zsomething, it will always load last :)
     
  3. Offline

    mindless728

    you could have your plugin run a separate thread that halts it's enabling until all other plugins are done
     
  4. Offline

    matejdro

    How do i know, when are all plugins done?
     
  5. Offline

    Dinnerbone Bukkit Team Member

    A world could be created + loaded by a command, three days after the server started. Your solution to your problem is very bad.

    What exactly do you need this for?
     
  6. Offline

    matejdro

    In MonsterHunt, i loaded all the world in onEnable and store ones that have MonsterHunt enabled. Of course only primary world work.

    But yeah, you are right. World can be activated any time. So i will change this to on demand. When world is loaded and enabled then activate it, otherwise leave it alone until is loaded.

    Thanks.
     
  7. Offline

    Dinnerbone Bukkit Team Member

    Yeah, just check WORLD_LOADED and match against that.
     
Thread Status:
Not open for further replies.

Share This Page