Vault Help

Discussion in 'Plugin Help/Development/Requests' started by RW_Craft, Nov 12, 2014.

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

    RW_Craft

    Yup, this is like my 100th request today =P I'm now stuck on vault. Here's (Some of) the code:
    http://pastebin.com/LR5C5rwT
    I'm trying to make a shop btw, vault won't do anything =/
    The error is:
    12.11 14:54:24 [Server] INFO Caused by: java.lang.NullPointerException

    Just added to the post, the error was a null pointer exception

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

    FerusGrim

    There are a bunch of inconsistencies in this code. Such as - but not limited to - making static calls from Bukkit, despite making a non-static call to Bukkit - literally - in the previous line.

    But let's ignore that, because that's not the issue at hand.

    To get down to it, though, could you provide us with a full stacktrace? We kinda need that to narrow down where the expection is being called from.

    Something I noticed, but I can't be sure is the issue because I don't have a stacktrace to work with, is that you're not correctly setting up your economy.

    Code:java
    1. private boolean setupEconomy() {
    2. if (getServer().getPluginManager().getPlugin("Vault") == null) {
    3. return false;
    4. }
    5. RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
    6. if (rsp == null) {
    7. return false;
    8. }
    9. Economy econ = rsp.getProvider();
    10. return econ !=null;
    11. }


    Notice how you're declaring the variable inside of that method? Well, you can't make calls to that later on. It's unique to that method. No, I will not show you how to correct this. It should be painfully obvious if you would learn Java before attempting to use the Bukkit API (something that we love to see happen, here).

    Just really quick, because I love shortening things (yay!).

    The above method is so useless for actually setting up the economy, it could literally be shorted to:
    Code:java
    1. private boolean setupEconomy() {
    2. return getServer().getPluginManager().getPlugin("Vault") != null && getServer().getServicesManager().getRegistration(Economy.class).getProvider() != null);
    3. }


    See? The entire method is one big boolean. Nothing is actually registered or setup anywhere. You're just checking things, really.

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

    RW_Craft

    FerusGrim When I click an item in the shop GUI, the console prints this:
    http://pastebin.com/0UqTKQFK
    Yes, I am running Spigot, but the EXACT same thing happens with bukkit (Apart from it doesn''t say Spigot), so let's just pretend it's bukkit =P (Yes, I mean CraftBukkit.jar, not bukkit,jar)
     
  4. Offline

    FerusGrim

  5. Offline

    RW_Craft

    FerusGrim K, I'll change it to CraftBukkit

    EDIT:
    Done
     
  6. Offline

    ZeldoKavira Administrator Curse

    Moved to spigot help section.
     
  7. Offline

    RW_Craft

  8. Offline

    ZeldoKavira Administrator Curse

    Started as spigot help, stays as spigot help.
     
Thread Status:
Not open for further replies.

Share This Page