Vault Issue

Discussion in 'Plugin Development' started by nggmc, Apr 16, 2013.

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

    nggmc

    I haven't done Java for a while and here is what I got when trying to update my plugins.
    Code:
    2013-04-18 18:34:27 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'lotto' in plugin MCLotto v4.0
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:188)
    at org.bukkit.craftbukkit.v1_5_R2.CraftServer.dispatchCommand(CraftServer.java:523)
    at net.minecraft.server.v1_5_R2.PlayerConnection.handleCommand(PlayerConnection.java:966)
    at net.minecraft.server.v1_5_R2.PlayerConnection.chat(PlayerConnection.java:884)
    at net.minecraft.server.v1_5_R2.PlayerConnection.a(PlayerConnection.java:841)
    at net.minecraft.server.v1_5_R2.Packet3Chat.handle(Packet3Chat.java:44)
    at net.minecraft.server.v1_5_R2.NetworkManager.b(NetworkManager.java:292)
    at net.minecraft.server.v1_5_R2.PlayerConnection.d(PlayerConnection.java:110)
    at net.minecraft.server.v1_5_R2.ServerConnection.b(SourceFile:35)
    at net.minecraft.server.v1_5_R2.DedicatedServerConnection.b(SourceFile:30)
    at net.minecraft.server.v1_5_R2.MinecraftServer.r(MinecraftServer.java:578)
    at net.minecraft.server.v1_5_R2.DedicatedServer.r(DedicatedServer.java:225)
    at net.minecraft.server.v1_5_R2.MinecraftServer.q(MinecraftServer.java:474)
    at net.minecraft.server.v1_5_R2.MinecraftServer.run(MinecraftServer.java:407)
    at net.minecraft.server.v1_5_R2.ThreadServerApplication.run(SourceFile:573)
    Caused by: java.lang.NullPointerException
    at me.pineabe.modernmc.Commands.onCommand(Commands.java:126)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
    ... 15 more
    Heres a link to my CommandExecutor class. http://pastebin.com/XMCran1S
     
  2. Offline

    stuntguy3000

    EconomyResponse r = econ.withdrawPlayer(p.getName(), plugin.getConfig().getInt("TicketFare"));

    Something on that line is null, my guess is plugin.getConfig().getInt("TicketFare")).

    Also, you don't have to have EconomyResponce for vault.
     
  3. I wouldn't think getting the int from the config is resulting that, more likely that you don't set the econ variable. Since it's a public variable, I don't know if you set it somewhere else (in the main class for example), but as far as I can see, you don't set it to something at all.
     
  4. Offline

    ZeusAllMighty11

    Your plugin variable is null, look at your constructor
     
  5. TheGreenGamerHD As long as he doesn't pass in null into the constructor, it won't.
     
  6. Offline

    Morthis

    Unless this changed very recently, config.getInt does not return null if the path doesn't exist (despite the JavaDocs saying it does).
     
  7. Offline

    stuntguy3000

    plugin

    Maybe plugin is null?
     
  8. ->
     
  9. Offline

    nggmc

    I've removed the economy response as a test. All the commands work perfectly fine except for /lotto buyticket. The command will work if you have the wrong ticket number or you have already purchased a ticket previously. It's become obvious this is a vault problem (i.e anything with Economy or EconomyResponse). I will try fix it or wait for an update. If not I will switch to Register or something. Thanks for your help.
     
  10. Like I said in my first post, are you sure you don't forget to set the econ variable?
     
  11. Offline

    nggmc

    Thanks for your help :) That was it I had econ set to null and the setupEconomy was in the main class all I needed to do was add this code to my onCommand boolean.
    Code:
    RegisteredServiceProvider<Economy> rsp = plugin.getServer().getServicesManager().getRegistration(Economy.class);
            econ = rsp.getProvider();
     
Thread Status:
Not open for further replies.

Share This Page