Solved Vault Dependency Not Working

Discussion in 'Plugin Development' started by Colby l, Feb 4, 2014.

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

    Colby l

    On startup, my plugin doesn't detect Vault, when it's placed into the plugins folder. I haven't haven't had this issue before, but now it randomly arose.

    Here's the beginning of my Main class:

    Code:java
    1. package com.ahellhound.bukkit.flypayment;
    2.  
    3. import java.util.logging.Logger;
    4.  
    5. import net.milkbowl.vault.economy.Economy;
    6.  
    7. import org.bukkit.ChatColor;
    8. import org.bukkit.Material;
    9. import org.bukkit.command.Command;
    10. import org.bukkit.command.CommandSender;
    11. import org.bukkit.entity.Player;
    12. import org.bukkit.event.EventHandler;
    13. import org.bukkit.event.EventPriority;
    14. import org.bukkit.event.Listener;
    15. import org.bukkit.event.entity.EntityDamageEvent;
    16. import org.bukkit.event.player.PlayerKickEvent;
    17. import org.bukkit.event.player.PlayerQuitEvent;
    18. import org.bukkit.event.server.ServerCommandEvent;
    19. import org.bukkit.inventory.PlayerInventory;
    20. import org.bukkit.plugin.RegisteredServiceProvider;
    21. import org.bukkit.plugin.java.JavaPlugin;
    22.  
    23. public class Main extends JavaPlugin implements Listener {
    24. Logger log = Logger.getLogger("Minecraft");
    25.  
    26. // eliminate Variables
    27. public static Economy econ = null;
    28. // Config instance variable
    29. private static Main instance;
    30. // Reload config instance variable
    31. private static Main reloadInstance;
    32.  
    33. @Override
    34. public void onEnable() {
    35. // Config instance
    36. instance = this;
    37. // reloads config
    38. reloadConfiguration();
    39. // checks if file exists
    40.  
    41. if (!setupEconomy() ) {
    42. log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
    43. getServer().getPluginManager().disablePlugin(this);
    44. return;
    45. }
    46.  
    47. saveDefaultConfig();
    48. getServer().getPluginManager().registerEvents(this, this);
    49. log.info("[" + getDescription().getName() + "] " + getDescription().getName() + " version " + getDescription().getVersion()
    50. + " is now enabled.");
    51. log.info("[" + getDescription().getName() + "]" + " Made By AhellHound");
    52. }
    53.  
    54. // Main instance
    55. public static Main getInstance() {
    56. return instance;
    57.  
    58. }
    59.  
    60. // Reload instance
    61. public static Main getReloadInstance() {
    62. return reloadInstance;
    63.  
    64. }
    65.  
    66. // Reloads configuration, creates tiers
    67. public void reloadConfiguration() {
    68. reloadConfig();
    69. reloadInstance = this;
    70.  
    71. }
    72.  
    73. // Hooks into Vault
    74. private boolean setupEconomy()
    75. {
    76. RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
    77. if (economyProvider != null) {
    78. econ = economyProvider.getProvider();
    79. }
    80.  
    81. return (econ != null);
    82. }
    83.  
    84. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {


    Also, here's my plugin.yml:

    Code:
    name: Fly Payment
    author: AhellHound
    main: com.ahellhound.bukkit.flypayment.Main
    version: 3.0b
    depend: [Vault]
    commands:
        fly:
            description: Start and stop flying.
            usage: /<command> <on:off:reload>
    permissions:
        flyp.fly:
            description: Allows you to use the /Fly on and /Fly off commands.
            default: op
        flyp.reload:
            description: Reloads the FlyPayment pugin.
            default: op
        flyp.bypass:
            default: op
            description: Bypasses the cost of an item to fly.
        flyp.takedamage:
            default: op
            description: Make's the user take damage after disabling flight.
        flyp.disableall:
            default: op
            description: Disables all of the player's flights. This is ideally used before a server reload or restart.
    Also, this happens on both versions of Vault, which may be due to changes in CB.

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

    xTigerRebornx

    Colby l According the people who make Vault, it doesn't break on updates. Is your server detecting Vault installed, and what exactly happens when you say "It doesn't detect Vault"? Does it throw errors, or is it shutting itself down?
     
  3. Offline

    Colby l

    Here's the log:
    Code:
    [19:19:13] [Server thread/INFO]: This server is running CraftBukkit version git-Bukkit-1.7.2-R0.2-36-g9f75167-b3005jnks (MC: 1.7.2) (Implementing API version 1.7.2-R0.3-SNAPSHOT)
    [19:19:14] [Server thread/INFO]: [Vault] Loading Vault v1.2.27-b349
    [19:19:14] [Server thread/INFO]: [Fly Payment] Loading Fly Payment v3.0b
    [19:19:14] [Server thread/INFO]: [Vault] Enabling Vault v1.2.27-b349
    [19:19:14] [Server thread/INFO]: [Vault][Permission] SuperPermissions loaded as backup permission system.
    [19:19:14] [Server thread/INFO]: [Vault] Enabled Version 1.2.27-b349
    [19:19:14] [Server thread/INFO]: Preparing level "world"
    [19:19:14] [Server thread/INFO]: Preparing start region for level 0 (Seed: -1906279788275077900)
    [19:19:14] [Server thread/INFO]: Preparing start region for level 1 (Seed: -1906279788275077900)
    [19:19:14] [Thread-7/INFO]: ----- Bukkit Auto Updater -----
    [19:19:14] [Thread-7/INFO]: It appears that you're running a Development Build, when you've specified in bukkit.yml that you prefer to run Recommended Builds.
    [19:19:14] [Thread-7/INFO]: If you would like to be kept informed about new Development Build releases, it is recommended that you change 'preferred-channel' in your bukkit.yml to 'dev'.
    [19:19:14] [Thread-7/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.
    [19:19:14] [Thread-7/INFO]: If you would like to disable this warning, simply set 'suggest-channels' to false in bukkit.yml.
    [19:19:14] [Thread-7/INFO]: ----- ------------------- -----
    [19:19:15] [Server thread/INFO]: Preparing start region for level 2 (Seed: -1906279788275077900)
    [19:19:15] [Server thread/INFO]: [Fly Payment] Enabling Fly Payment v3.0b
    [19:19:15] [Server thread/ERROR]: [Fly Payment] - Disabled due to no Vault dependency found!
    [19:19:15] [Server thread/INFO]: [Fly Payment] Disabling Fly Payment v3.0b
    [19:19:15] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [19:19:15] [Server thread/INFO]: Done (1.220s)! For help, type "help" or "?"
     
  4. Offline

    xTigerRebornx

    Colby l Do you have an Economy plugin installed? Thats probably the problem, as you are using the econ part
     
  5. Offline

    Colby l

    Figured it out, thanks for the help!
     
    Sleaker likes this.
  6. Offline

    Sleaker

    Your Error message might be a bit confusing instead of dumping a 'Cannot find Vault dependency Message' you may want to state 'Could not find an economy plugin. Make sure you have one installed!' - if Vault wasn't on the server your plugin would get caught by Bukkit with a missing dependency exception and there would be a massive stack trace before it even loaded up to that message.

    Glad you got it all working though, happy coding!
     
Thread Status:
Not open for further replies.

Share This Page