Plugin missing vault dependency when is does exist

Discussion in 'Plugin Development' started by MusicalCreeper01, Jun 24, 2014.

Thread Status:
Not open for further replies.
  1. Hey guys,

    I'm working on a Bukkit plugin, and have ran into an error. When I try to test my plugin I get:

    [14:51:15 INFO]: [Musical_Utilis] Enabling Musical_Utilis v0.1
    [14:51:15 INFO]: [Musical_Utilis] onEnable has been invoked!
    [14:51:15 ERROR]: [Musical_Utilis] - Disabled due to no Vault dependency found!
    [14:51:15 INFO]: [Musical_Utilis] Disabling Musical_Utilis v0.1
    [14:51:15 INFO]: [Musical_Utilis] onDisable has been invoked!
    I might add, the disabling message isn't a Bukkit message , it is a message from the code in my main file, more specificity, from the function setupEconomy() that I copied and pasted from the setup instructions for Vault. I have tracked the error down the the line:
    RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
            if (rsp == null) {
                return false;
    in the setupEconomy() function

    You can view my source code here:

    And here is the full log readout:
    Loading libraries, please wait...
    [14:51:12 INFO]: Starting minecraft server version 1.7.2
    [14:51:12 INFO]: Loading properties
    [14:51:12 INFO]: Default game type: CREATIVE
    [14:51:12 INFO]: Generating keypair
    [14:51:13 INFO]: Starting Minecraft server on *:25565
    [14:51:13 INFO]: This server is running CraftBukkit version git-Bukkit-1.7.2-R0.3-b3020jnks (MC: 1.7.2) (Implementing API version 1.7.2-R0.3)
    [14:51:13 INFO]: [Vault] Loading Vault v1.2.31-b411
    [14:51:13 INFO]: [Musical_Utilis] Loading Musical_Utilis v0.1
    [14:51:13 INFO]: [Vault] Enabling Vault v1.2.31-b411
    [14:51:13 INFO]: [Vault] [Vault][Permission] SuperPermissions loaded as backup permission system.
    [14:51:13 INFO]: [Vault] [Vault] Enabled Version 1.2.31-b411
    [14:51:13 INFO]: Preparing level "newworld"
    [14:51:13 INFO]: Preparing start region for level 0 (Seed: 634125925809554466)
    [14:51:14 INFO]: Preparing start region for level 1 (Seed: 634125925809554466)
    [14:51:14 INFO]: ----- Bukkit Auto Updater -----
    [14:51:14 INFO]: It appears that you're running a Beta Build, when you've specified in bukkit.yml that you prefer to run Recommended Builds.
    [14:51:14 INFO]: If you would like to be kept informed about new Beta Build releases, it is recommended that you change 'preferred-channel' in your bukkit.yml to 'beta'.
    [14:51:14 INFO]: With that set, you will be told whenever a new version is available for download, so that you can always keep up to date and secure with the latest fixes.
    [14:51:14 INFO]: If you would like to disable this warning, simply set 'suggest-channels' to false in bukkit.yml.
    [14:51:14 INFO]: ----- ------------------- -----
    [14:51:14 INFO]: Preparing start region for level 2 (Seed: 634125925809554466)
    [14:51:15 INFO]: [Musical_Utilis] Enabling Musical_Utilis v0.1
    [14:51:15 INFO]: [Musical_Utilis] onEnable has been invoked!
    [14:51:15 ERROR]: [Musical_Utilis] - Disabled due to no Vault dependency found!
    [14:51:15 INFO]: [Musical_Utilis] Disabling Musical_Utilis v0.1
    [14:51:15 INFO]: [Musical_Utilis] onDisable has been invoked!
    [14:51:15 INFO]: Server permissions file permissions.yml is empty, ignoring it
    [14:51:15 INFO]: Done (1.582s)! For help, type "help" or "?"
    [14:51:16 INFO]: [Vault] Checking for Updates:
    [14:51:16 WARN]: [Vault] Stable Version: 1.4.1 is out! You are still running version: 1.2.31
    [14:51:16 WARN]: [Vault] Update at:
    [14:53:39 INFO]: Stopping server


    Here is the code from the main class that is causeing the trouble:

    1. package co.nuritech.musicalutilis;
    3. import java.util.logging.Logger;
    5. import net.milkbowl.vault.economy.Economy;
    7. import org.bukkit.plugin.Plugin;
    8. import org.bukkit.plugin.RegisteredServiceProvider;
    9. import;
    11. public class MusicalUtilis extends JavaPlugin {
    13. private static final Logger log = Logger.getLogger("Minecraft");
    14. private static Plugin instance;
    15. public static Economy econ = null;
    18. @Override
    19. public void onEnable() {
    21. getLogger().info("onEnable has been invoked!");
    22. instance = this;
    23. if (!setupEconomy() ) {
    24. log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
    25. getServer().getPluginManager().disablePlugin(this);
    26. return;
    27. }
    28. // ...
    29. // This will throw a NullPointerException if you don't have the command defined in your plugin.yml file!
    30. getCommand("money").setExecutor(new MusicalUtilisCommandExecutor());
    31. getCommand("permission").setExecutor(new MusicalUtilisCommandExecutor());
    32. getCommand("groupmsg").setExecutor(new MusicalUtilisCommandExecutor());
    34. // ...
    35. }
    37. private boolean setupEconomy() {
    38. if (getServer().getPluginManager().getPlugin("Vault") == null) {
    39. return false;
    40. }
    41. RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
    42. if (rsp == null) {
    43. return false;
    44. }
    45. econ = rsp.getProvider();
    46. return econ != null;
    47. }
    49. public static Plugin getInstance() {
    50. return instance;
    51. }
    52. public static Economy getEconomy(){
    53. return econ;
    54. }
    56. @Override
    57. public void onDisable() {
    58. // TODO Insert logic to be performed when the plugin is disabled
    59. getLogger().info("onDisable has been invoked!");
    60. }
    62. //vault
    66. }
  2. Offline


    not going to search entire githubrepo in order to find classes at play.

    post source of class that not working as expected.
    class must contain debug messages.
    sample of debug trace must be included.
  3. Offline


    MusicalCreeper01 you are also required to have a supported economy plugin in your plugins folder, in order to access the Economy API.
  4. I added the source code from the main class that is causing the issue.

    I have vault for 1..7.2.R0.3, which is the version I'm developing for, in the plug-ins folder along with my plugin.

    I should also add that I ran some tests, and found that Bukkit is loading Vault, and that my plugin can indeed find Vault, but the line to initiate the economy system is causing it to disable. I can't figure out why it is not finding the economy class. for reference, here is the line I'm talking about:
    1. RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
    2. if (rsp == null) {
    3. return false;
    4. }

    I updated the first post with the class ;)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 9, 2016
  5. Offline


  6. Oh, I see, so I would have to have something like iEconomy in the plugin folder as well?
  7. Offline


  8. Offline


    You must have one economy plugin installed (like iConomy) to start / test / debug your plugin, but others can just use Vault with their economy plugin (like essentials economy f.e.)
Thread Status:
Not open for further replies.

Share This Page