Solved [Upgrade Shop] Debug

Discussion in 'Plugin Development' started by Fight_Or_Die, Feb 20, 2014.

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

    Fight_Or_Die

    ===POST SOLVED===
     
  2. Offline

    Acer_Mortem

    Fight_Or_Die

    Can you tell us the specific line in which you're having the error? In your posts, you stated that it's a problem with getServer(), however the stack trace says it's on line 51, which doesn't have that piece of code.
     
  3. Offline

    Fight_Or_Die

    Acer_Mortem - The error on line 51 is displayed in the console when I try to click the item in the menu, while it doesn't cancel the menu out. I assume that line 51 (the economy) is causing an error, but I can't determine exactly what it is.. The menu worked fine before trying to check for and subtracts funds and adding Pex setGroup..

    Also, the getServer() error is found on line 34 of my MenuRank class with the error "The method getServer() is undefined for the type MenuRank."
     
  4. Offline

    Acer_Mortem

    Fight_Or_Die

    As for the economy error, you're getting the problem because you never run the setupEconomy method (run it in the onEnable).

    For the getServer() error, I have no idea, however this is the code I use for that method:

    Code:
        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;
        }
     
  5. Offline

    Gater12

    Fight_Or_Die
    Use Bukkit.getServer() or hell Bukkit alone if you choose.
     
  6. Offline

    Fight_Or_Die

    -SNIP- To protect code.
     
  7. Offline

    Gater12

    Fight_Or_Die
    "Programmers don't care about warnings- Only about errors." - Some joke on stackoverflow

    It's your IDE saying "AYY that method, it's not being used-locally."
     
  8. Offline

    Fight_Or_Die

    -SNIP- To protect code.
     
  9. Offline

    Acer_Mortem

    Fight_Or_Die

    Well, did you check if the player had more than or equal to 1500 before withdrawing it? :)
     
  10. Offline

    Fight_Or_Die

    -SNIP- To protect code.
     
  11. Offline

    Acer_Mortem

    Fight_Or_Die

    Are you sure econ is not null? That's the only thing I could think of.
     
  12. Offline

    Fight_Or_Die

    -SNIP- To protect code.
     
  13. Offline

    Acer_Mortem

    Fight_Or_Die

    Take all of that code setup econ code, and put it in your main class. Then run the setupEcon (or whatever) method from your onEnable. I believe that's where the problem lies.
     
  14. Offline

    Fight_Or_Die

    Acer_Mortem
    Thank you - I've solved the problem. I truly appreciate your help :)
     
Thread Status:
Not open for further replies.

Share This Page