Solved Vault Soft-Dependancy

Discussion in 'Plugin Help/Development/Requests' started by 2008Choco, May 9, 2015.

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


    I seem to be having issues with linking to Vault. Now this is the strange part. The issue isn't actually linking to Vault itself, because it works perfect when it loads, and does everything I want it to. The issue is when Vault isn't there.

    If Vault isn't installed on the server when my plugin loads up, the plugin won't load because obviously it can't find the Vault library. This plugin isn't supposed to be dependant on vault, I want it to soft-depend on it. I've added "Softdepend: [Vault]" in the plugin.yml, so I know 100% sure that's not the issue. I also added the blocks of code that Vault had provided to link into it (again it works fine when Vault is installed). I just want to know, how do I load my plugin without an error if Vault isn't installed.
  2. You should make your vault dependencies only kick in when it is in there,

    Add something like this:
    public class YouClass extends JavaPlugin {
       boolean vault = false;
       // If this equals true then vault is in here
       public void onEnable(){
           if(Bukkit.getServer().getPluginManager().getPlugin("Vault") != null){
                     vault = true;
        // Check if vault exist with this line
          // Code using vault
           // Vault is not loaded stuff.
    Last edited: May 9, 2015
    2008Choco likes this.
  3. Offline


    @loslobos1234 You are a saint from above, my friend. Thank you :) It worked perfect <3
  4. No problem.
Thread Status:
Not open for further replies.

Share This Page