Plug-in post-load initialisation

  • Background:


    When Plugin.onEnable() is called, the plug-in being enabled cannot be sure that all other installed plug-ins have been loaded and known to the system (as this depends upon the plug-in loading order which is largely unpredictable).


    Then, it cannot check for another plug-in (required for some tasks and/or for additional plug-in features) to be present (well, it may, of course, but it might receive a 'false negative' if the required other plug-in is present but not loaded yet).


    There are work-around, of course. So far, the best I could think of is to check for the 'other' plug-in presence in the PlayerConnectEvent, which is rare enough to not overload the server and guaranteed to occur after all plug-ins have been loaded.


    Request:


    A) The loop of Plugin.onEnable() calls is moved after all plug-ins are loaded.


    OR


    B) Another event call is added (onReady()?, onLoaded()?, ...), which is called -- once for each plug-in -- after all plug-ins have been loaded.


    OR


    C) Anything else along these lines! :D


    Thanks.

  • Makes sense :) With the next update, the "onEnable()" method will be called after all plugins have been loaded. To be on the safe side, we will also add an overridable "onLoad()" method, which will be called once the plugin is loaded (although in most cases you probably don't need the "onLoad()" method, since nearly all initialization stuff can still be done on the "onEnable()" method - for that reason, "onLoad()" will be non abstract, so your plugins don't have to override it)

  • Makes sense :) With the next update, the "onEnable()" method will be called after all plugins have been loaded. To be on the safe side, we will also add an overridable "onLoad()" method, which will be called once the plugin is loaded (although in most cases you probably don't need the "onLoad()" method, since nearly all initialization stuff can still be done on the "onEnable()" method - for that reason, "onLoad()" will be non abstract, so your plugins don't have to override it)

    Great, thanks!

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!