Solved How to use method onLoad()

Discussion in 'Plugin Development' started by sebagius7110, May 16, 2014.

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

    sebagius7110

    I need help, how do you use the method onLoad() to see if a plugin is installed, for example checking if an API plugin is installed. Once I get help, it will be really appreciated.

    -sebagius7110 (bukkit plugin dev)
     
  2. Offline

    caseif

    If you want to add a dependency, just add
    Code:
    depends: APIName
    to your plugin.yml. Alternatively, you could add soft dependency and add this code to your onEnable() (onLoad() isn't necessary):
    Code:java
    1. if (!Bukkit.getPlugimManager().isPluginEnabled("APIName")){ // if the API isn't present
    2. Bukkit.getPluginManager().disablePlugin(this); // disable your plugin
    3. return; // make sure the rest of the onEnable() doesn't execute
    4. }
     
  3. Offline

    sebagius7110

    Thank you, This is now solved and the topic can be locked. Again thankyou
     
  4. Offline

    caseif

    Just FYI, solved threads aren't usually locked unless the OP requests it. However, setting its status to "Solved" should do the trick.
     
  5. Offline

    sebagius7110


    Ok thanks
     
Thread Status:
Not open for further replies.

Share This Page