Error using Vault

Discussion in 'Plugin Development' started by desup, Mar 18, 2012.

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

    desup

    Hey, I need to use Vault in my plugin but I'm getting NullPointerExcecption error while setting up economy.
    Method looks like this:
    Code:
    public boolean setupEconomy() {
            if (plugin.getServer().getPluginManager().getPlugin("Vault") == null) {
                return false;
            }
            RegisteredServiceProvider<Economy> rsp = plugin.getServer().getServicesManager().getRegistration(Economy.class);
            if (rsp == null) {
                return false;
            }
            economy = rsp.getProvider();
            return economy != null;
           
        }
    What's wrong with this?
     
  2. Offline

    Njol

    Maybe plugin is null?
    You can almost always replace the plugin instance with 'Bukkit', e.g. Bukkit.getServer() returns the server singleton.
     
  3. Offline

    desup

    Yes, thank you for quick fix ;)
     
Thread Status:
Not open for further replies.

Share This Page