Searching if a plugin is in the plugins folder.

Discussion in 'Plugin Development' started by CevinWa, Oct 22, 2012.

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

    CevinWa

    Im trying to do this but everytime i just get the else as an output here's my code would appruciate some help :D
    //CevinWa






    Code:

    String plugins = this.getServer().getPluginManager().getPlugins().toString();
    if (plugins.contains("omc.lib")){
    this.logger.info( "[SpecialEffects] omc lib detected using it's methods");

    }else{
    this.logger.info( "[SpecialEffects] omc lib was not detected using own methods. Hint! this plugin runs smoother with omc-lib");
    }
     
  2. Offline

    Jazed

    Maybe I am over-thinking this but you could navigate to the folder and check if the file exists.
     
  3. Offline

    makskay

    Code:
    Plugin lib = Bukkit.getPluginManager().getPlugin("pluginNameAsStringLiteral");
     
    if (lib == null) {
        // use own methods
    }
     
    else {
        // use library methods via lib
    }
    
     
  4. Offline

    CevinWa

    Thanks
     
Thread Status:
Not open for further replies.

Share This Page