Softdepend issues

Discussion in 'Plugin Development' started by Quantum64, Apr 30, 2014.

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

    Quantum64

    So if you softdepend on something, say BarAPI, the point is to have it as an optional feature. Meaning that the users don't have to install it if they don't want to. So if I softdepend on BarAPI, how do I prevent the users getting NoClassDefFoundError? I would catch it every time I use BarAPI.whatever(), but that seems quite messy, and NoClassDefFound is a subclass of Error, which to my understanding is not supposed to be caught at all.
     
  2. Offline

    Konkz

    http://wiki.bukkit.org/Plugin_YAML

    Not sure if this works, but if you look you have depend and softdepend - from it's description
    it looks as if the plugins that are listed are there to provide full functionality and not
    usability.
     
  3. Offline

    xTigerRebornx

    Quantum64 You'll want to softdepend, then when your plugin is enabling, check to see if BarAPI is installed (the Plugin is on the server), and if it isn't disable your plugin and return out of the method, preventing any further code from being run. Your registering of commands/events would then be moved to after the check
     
    Quantum64 likes this.
  4. Offline

    Europia79

    Quantum64

    Dude, I know exactly what you mean... I had another plugin that I wanted to be an optional dependency and avoid the start-up exceptions.

    Because I couldn't find much information on this topic, I wrote a tutorial:
    http://forums.bukkit.org/threads/tutorial-java-optional-dependencies-at-runtime.256579/

    Long story short, I had this in my main class:
    Code:java
    1. TrackerInterface ti;


    And replaced TrackerInterface with my own class:
    Code:java
    1. // TrackerInterface ti;
    2. PlayerStats ti;


    Notice, that with this trick, you'll retain all references to the ti field.

    Hopefully this helps. Lemme know if you need more help.
     
  5. Offline

    Quantum64

    Thanks, your method worked.
     
Thread Status:
Not open for further replies.

Share This Page