[Line/Intermediate] Checks for other plugins - SIMPLE

Discussion in 'Resources' started by Jaker232, Nov 23, 2011.

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

    Jaker232

    If you want to support your plugin by checking for others plugin, put the following in your plugin.yml.

    Code:
    softdepend: [Plugin, AnotherPlugin]
    
    Let's say you want to hook into Spout, but it's not required.
    Code:
    softdepend: [Spout]
    
    and you also want mcMMO...
    Code:
    softdepend: [Spout, mcMMO]
    
    Simple as that. I had to write this because there was many questions asking how to check to see if other plugins that are hooked into their plugin is enabled.

    EDIT:

    If you want your code to work, please put..
    Code:java
    1.  
    2. JavaPlugin toCheck = Bukkit.getServer().getPluginManager().getPlugin(mcMMO);
    3. if(toCheck != null) {
    4. log.info("Detected mcMMO!");
    5. }
    6.  
    7. Replace mcMMO with a plugin. If you want to check for two plugin, just copy the code again and change the variables. Thanks to @[URL='http://forums.bukkit.org/members/pandemoneus.94801/']Pandemoneus[/URL] for showing me this.
    8.  
    9. EDIT DOUBLE:
    10. If you want your plugin to have the following plugin, do
    11. [code]
    12. depend: [mcMMO]
    13. [/code]
     
  2. Offline

    iffa

    Might want to include something about
    Code:
    depend: [Plugin, Plugin2]
     
  3. Offline

    Pandemoneus

    You actually didn't even check yet.
    At the moment your plugin loads after the other ones, but you are not checking in any way whether the other plugins are actually installed on the server.
     
  4. Offline

    Jaker232

    I'll try to learn it from the Javadocs.
     
  5. Offline

    Pandemoneus

    Code:java
    1. JavaPlugin toCheck = Bukkit.getServer().getPluginManager().getPlugin(nameOfPlugin);
    2. if (toCheck != null) {
    3. System.out.println(nameOfPlugin + " found.");
    4. }
     
  6. Offline

    Jaker232

    Oohh. I'll post it. Thanks!
     
  7. Offline

    DrBowe

    As @iffa said, it's probably best that you include info about 'depend:' as well.

    Let's say you want your plugin to have support for Spout, but not require it:
    softdepend: Spout

    But it absolutely needs mcMMO to run:
    depend: mcMMO

    softdepend if your plugin doesn't rely on it.
    depend if it shouldn't even start up if the other plugin isn't found.
     
  8. Offline

    Sleaker

    The point of writing a tutorial is to share information you have already mastered and know well. Please stop writing tutorials for people with things that you don't even understand fully yourself, and need to be corrected or helped with. I appreciate your willingness to write tutorials, but... yah...
     
  9. Offline

    Don Redhorse

    also what should be noted is that softdepend and depend doesn't seem to work always.. I found it best to use the softdepend / depend and afterwards use a server listener and some logic to look the the plugin becomes available and is initialized correctly... don't know if it is the best code though how I do it... but it works 100% up to now..
     
Thread Status:
Not open for further replies.

Share This Page