Solved Problems with vault API!

Discussion in 'Plugin Development' started by mcrazmouze, Sep 11, 2016.

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

    mcrazmouze

    When i do /plugins it shows as red! I've checked logs, and it dosen't say sanything!

    My code:
    Code:
    package me.bukkit.RazMouze;
    
    import java.util.logging.Logger;
    
    import org.bukkit.plugin.RegisteredServiceProvider;
    import org.bukkit.plugin.java.JavaPlugin;
    
    import net.milkbowl.vault.economy.Economy;
    
    public class MNPCmain extends JavaPlugin {
    
        private static final Logger log = Logger.getLogger("Minecraft");
        public static Economy econ = null;
         @Override
           public void onDisable() {
               log.info(String.format("[%s] Disabled Version %s", getDescription().getName(), getDescription().getVersion()));
           }
    
           @Override
           public void onEnable() {
               if (!setupEconomy() ) {
                   log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
                   getServer().getPluginManager().disablePlugin(this);
                   return;
               }
           }
    
          
           private boolean setupEconomy() {
               if (getServer().getPluginManager().getPlugin("Vault") == null) {
                   return false;
               }
               RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
               if (rsp == null) {
                   return false;
               }
               econ = rsp.getProvider();
               return econ != null;
           }
          
    }
    
     
    Last edited by a moderator: Sep 11, 2016
  2. Offline

    timtower Moderator Moderator

  3. Offline

    JanTuck

    It's red? Have you added vault to the plugins folder?
     
  4. Offline

    mcrazmouze

  5. Offline

    JanTuck

    [12:23:35] [Server thread/ERROR]: [MyNPC] - Disabled due to no Vault dependency found!

    Economy plugin?
    Like essentials.
    Sent from Tapatalk
     
  6. Offline

    timtower Moderator Moderator

    @mcrazmouze "Disabled due to no Vault dependency found!"
    Did you install an Economy plugin as well?
     
  7. Offline

    mcrazmouze

    Yes... Ohh i had forgotten some essentials stuff.. GG

    Thanks guys :)!
     
  8. Offline

    JanTuck

    Vault is not an economy plugin get something like Essentials or Iconomy too

    Sent from Tapatalk
     
Thread Status:
Not open for further replies.

Share This Page