Make vault detect if no plugin is hooked?

Discussion in 'Plugin Development' started by TopGear93, Mar 12, 2013.

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


    How can I make vault detect if an economy, chat, or permissions plugin is not hooked to vault but within my plugin? For example, if I type /givemoney and theres no money plugin hooked to vault how can I make my plugin say "No economy plugin detected" instead of throwing an error?
  2. Offline


    Vault's API example covers this. They make a boolean method called setupEconomy(), go look at it.
    TopGear93 likes this.
  3. Offline


  4. Offline


    I've already had this in my plugin since the beginning. I'm not seeing a way to detect if one of the "supported" plugins are unhooked. I must not be seeing something. It shouldn't be this difficult.
  5. Offline


    Here is an example of how I've done in my plugin.

    2. private void setupVault() {
    3. if (this.getServer().getPluginManager().getPlugin("Vault") == null) {
    4."[SimpleSpleef] Vault was not found. Economy rewards will not work!");
    5. return;
    6. }
    8. ServicesManager manager = this.getServer().getServicesManager();
    9. RegisteredServiceProvider<Economy> e = manager.getRegistration(net.milkbowl.vault.economy.Economy.class);
    11. if (e != null) {
    12. SSSettings.getInstance().vault = true;
    13. SSSettings.getInstance().economy = e.getProvider();
    14. } else {
    15. SSSettings.getInstance().vault = false;
    16."[SimpleSpleef] Vault found, but no economy plugin detected. Economy rewards will not work!");
    17. }
    18. }
    TopGear93 likes this.
  6. Offline


    ah, now that makes perfect sense :D. Thanks for the help.
Thread Status:
Not open for further replies.

Share This Page