Solved Vault API plugin won't recognise EssentialsX Economy

Discussion in 'Plugin Development' started by jamie_, Oct 28, 2022.

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

    jamie_

    Hi All,
    I am at a very rudimentary stage for developing plugins. I am well-versed in C#, but I'm learning Java slowly.

    I'm trying to make a basic plugin for my server. I'm trying to connect Vault to make an plugin which uses the economy (provided by EssentialsX), so far I've managed to get the server to link to Vault, but for the life of me, it will not recognise Essentials economy.

    This is the `main.java`, all imports are omitted:
    Code:
    public class Main extends JavaPlugin {
    
        private static final Logger log = Logger.getLogger("Minecraft");
        private 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 (!setUpVault() || !setupEconomy()) {
                log.severe(String.format("[%s] Did not work properly!", getDescription().getName()));
                getServer().getPluginManager().disablePlugin(this);
            }
        }
    
        private boolean setUpVault() {
            if (getServer().getPluginManager().getPlugin("Vault") != null) {
                log.info(String.format("[%s] VAULT INITIALISED", getDescription().getName()));
                return true;
            } else {
                return false;
            }
        }
    
        public boolean setupEconomy() {
            RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
            if (rsp == null) {
                log.info(String.format("[%s] ECONOMY FAILED TO LINK", getDescription().getName()));
                return  false;
            } else {
                log.info(String.format("[%s] ECONOMY HAS LINKED", getDescription().getName()));
                econ = rsp.getProvider();
                return true;
            }
        }
    }
    I followed what I found on the readme, plus some modifications due to debugging.

    My plugin.yml does contain the following:
    Code:
    name: GolfCraft-Core # the plugins name as it should appear in the plugin list /pl
    version: 1.0 # the plugin's version
    author: my awesome lit name
    main: com.example.GolfCraftCore.Main
    depend:
      - Vault
    softdepend:
      - Essentials
    api-version: 1.19
    
    Here is the relevant server output:

    Code:
    [04:42:58] [Server thread/INFO]: [Vault] [Economy] Essentials Economy hooked.
    [04:42:58] [Server thread/INFO]: Using superperms-based permissions.
    [04:42:58] [Server thread/INFO]: [GolfCraft-Core] Enabling GolfCraft-Core v1.0
    [04:42:58] [Server thread/INFO]: [GolfCraft-Core] VAULT INITIALISED
    [04:42:58] [Server thread/INFO]: [GolfCraft-Core] ECONOMY FAILED TO LINK
    [04:42:58] [Server thread/ERROR]: [GolfCraft-Core] Did not work properly!
    [04:42:58] [Server thread/INFO]: [GolfCraft-Core] Disabling GolfCraft-Core v1.0
    [04:42:58] [Server thread/INFO]: [GolfCraft-Core] Disabled Version 1.0
    [04:42:58] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [04:42:58] [Server thread/INFO]: Done (22.213s)! For help, type "help"
    [04:42:58] [Server thread/INFO]: Essentials found a compatible payment resolution method: Vault Compatibility Layer (v1.7.3-b131)!
    [04:42:58] [Craft Scheduler Thread - 0/INFO]: ยบ6Fetching version information...
    [04:42:58] [Craft Scheduler Thread - 1/INFO]: [Vault] Checking for Updates ...
    [04:42:58] [Craft Scheduler Thread - 1/INFO]: [Vault] No new version available
    Please just tell me I'm missing something blatantly obvious. The server has Vault installed, along with this plugin and EssentialsX. I have been at this for several hours and I've Googled absolutely everything related to this.

    Thank you for your help, I wish you all very well.

    I wasn't building the JAR properly, you have to build using Maven. In IntelliJ, you can ignore project structure and just edit the pom.xml file. Make sure to build using the Maven tab, Lifecycle, and package; don't build Artifact (using project structure).

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 28, 2022
  2. Offline

    Strahan

    I see you tagged it as solved. Out of curiosity, what was the issue?
     
  3. Offline

    timtower Administrator Administrator Moderator

    @Strahan
     
  4. Offline

    Strahan

    Ah, I'm blind lol. Thanks.
     
Thread Status:
Not open for further replies.

Share This Page