onEnable() Question.

Discussion in 'Spigot Plugin Development' started by Aeryes, May 11, 2016.

  1. Hey guys,

    I am fairly new to the Spigot API. I have just a few questions in regards to how the order of onEnable() effects code speed at run time.

    For example:

    @.Override
    public void onEnable() {

    getServer().getPluginManager().registerEvents(new PlayerListener(), this);

    getLogger().info("Plugin has been Enabled!");



    }


    In the above code does the order of Listener versus the order of my Logger effect the speed of my code. Is it more advisable to have my Logger before anything else or does it make a difference. I am led to believe that the Listener will be ran first as it is first in line, is this correct to think?

    Any help is much appreciated.

    Aeryes.
     
  2. Unless for some reason enabling your PlayerListener crashes the server, there will be no difference.
     
  3. Thank you very much for your response.
     
  4. The listener will be ran first, but it most likely will have unnoticeable delay to the log message. It makes more sense to have the log message at the end anyways since that is the point when your plugin is fully enabled.
     
  5. Okay that makes perfect sense. Thank you.