[SOLVED] Run code after all plugins enable

Discussion in 'Plugin Development' started by niccholaspage, May 6, 2011.

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

    niccholaspage

    I want to run code after all plugins get enabled/reloaded. This is for my nSpleef plugin, since if a world is not loaded before nSpleef gets enabled, it will error. Is there anyway to run code after all plugins get enabled so I can just setup the arenas from there?
     
  2. Offline

    matejdro

    I had similar question, but it was proven wrong concept.

    Plugins may load after server load and i can type new world command 20 minutes after server restart.

    You should not load all worlds on start, but rather re-check worlds when you need them.
     
  3. Offline

    niccholaspage

    Could I use onWorldLoad in a WorldListener? I'd just setup the arenas every time a world gets loaded.
     
  4. Offline

    matejdro

    That might work, but another plugin may load world before your plugin, so event will not even get to you.

    Oh, you mean place new blocks for spleef to begin? I'm not completely sure, how would you do that. Maybe leave arenas and just rebuild them when you enter command?
     
  5. Offline

    niccholaspage

    Even if a plugin loads a world before nSpleef enables, it will still work, since then when it sets up the arenas on enable that world will already be there.
     
  6. Offline

    NateLogan

  7. Offline

    matejdro

    Nope, but i have figured out that you have to check loaded worlds on demand instead of loading them on startup.
     
  8. Offline

    niccholaspage

    I found out how! In onEnable:
    Code:
            getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable(){
            	public void run(){
                        //Code here
            	}
            });
     
Thread Status:
Not open for further replies.

Share This Page