Solved Can't register to Vault ?

Discussion in 'Plugin Development' started by haussik, Oct 7, 2018.

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

    haussik

    I've been looking around for about 4-5 hours but no success. I am creating my own economy plugin but i can't seem to be able to hook the plugin to vault.

    I've done the following:
    Code:
    private Main main;
    public VaultHook(Main main){
    this.main = main;
    }
    
    public void hook(ServicePriority priority) {
    try {
    Economy econ = BalanceService.class.getConstructor(Main.class).newInstance(main);
    main.sm.register(Economy.class, econ, main, priority);
    } catch (Exception e) {
    e.printStackTrace();}
    }
        }
    BalanceService is my economy class that extends AbstractEconomy from Vault, which implements Economy.
    Main class extends JavaPlugin, so this is the entry class for the plugin.
    sm is the ServicesManager from Bukkit API.

    But even with all of this other plugins do detect my economy class but can't seem to send money.

    Here's the full code : https://github.com/Chargnn/Nugget

    Fixed:

    Code:
        private Main main;
    
        public VaultHook(Main main){
            this.main = main;
        }
    
        public void hook(ServicePriority priority) {
            main.sm.register(Economy.class, new BalanceService(), main, priority);
        }
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 7, 2018
Thread Status:
Not open for further replies.

Share This Page