Solved Method Error

Discussion in 'Spigot Plugin Development' started by Laurenshup, May 30, 2016.

Thread Status:
Not open for further replies.
  1. So i was recoding my plugin that it has 2 classes but when i run the command there is a error!

    The plugin is a calculator. I'm making the plugin smaller (2 Classes) because i can add more things simpler.
    So when i type: /calc calc 5 + 5. What should have to turn 10 will give me this error:

    Code (Text):
    30-5-2016 20:07:59 [INFO] Laurenshup issued server command: /calc calc 5 + 5
    30-5-2016 20:07:59 [ERROR] null
    30-5-2016 20:07:59 org.bukkit.command.CommandException: Unhandled exception executing command 'calc' in plugin SuperCalculator v1.2
    30-5-2016 20:07:59 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot-1.9.4.jar:git-Spigot-8a048fe-d8637df]
    30-5-2016 20:07:59 at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot-1.9.4.jar:git-Spigot-8a048fe-d8637df]
    30-5-2016 20:07:59 at org.bukkit.craftbukkit.v1_9_R2.CraftServer.dispatchCommand(CraftServer.java:646) ~[spigot-1.9.4.jar:git-Spigot-8a048fe-d8637df]
    30-5-2016 20:07:59 at net.minecraft.server.v1_9_R2.PlayerConnection.handleCommand(PlayerConnection.java:1349) [spigot-1.9.4.jar:git-Spigot-8a048fe-d8637df]
    30-5-2016 20:07:59 at net.minecraft.server.v1_9_R2.PlayerConnection.a(PlayerConnection.java:1184) [spigot-1.9.4.jar:git-Spigot-8a048fe-d8637df]
    30-5-2016 20:07:59 at net.minecraft.server.v1_9_R2.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot-1.9.4.jar:git-Spigot-8a048fe-d8637df]
    30-5-2016 20:07:59 at net.minecraft.server.v1_9_R2.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot-1.9.4.jar:git-Spigot-8a048fe-d8637df]
    30-5-2016 20:07:59 at net.minecraft.server.v1_9_R2.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.9.4.jar:git-Spigot-8a048fe-d8637df]
    30-5-2016 20:07:59 at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_91]
    30-5-2016 20:07:59 at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_91]
    30-5-2016 20:07:59 at net.minecraft.server.v1_9_R2.SystemUtils.a(SourceFile:45) [spigot-1.9.4.jar:git-Spigot-8a048fe-d8637df]
    30-5-2016 20:07:59 at net.minecraft.server.v1_9_R2.MinecraftServer.D(MinecraftServer.java:726) [spigot-1.9.4.jar:git-Spigot-8a048fe-d8637df]
    30-5-2016 20:07:59 at net.minecraft.server.v1_9_R2.DedicatedServer.D(DedicatedServer.java:399) [spigot-1.9.4.jar:git-Spigot-8a048fe-d8637df]
    30-5-2016 20:07:59 at net.minecraft.server.v1_9_R2.MinecraftServer.C(MinecraftServer.java:665) [spigot-1.9.4.jar:git-Spigot-8a048fe-d8637df]
    30-5-2016 20:07:59 at net.minecraft.server.v1_9_R2.MinecraftServer.run(MinecraftServer.java:564) [spigot-1.9.4.jar:git-Spigot-8a048fe-d8637df]
    30-5-2016 20:07:59 at java.lang.Thread.run(Unknown Source) [?:1.8.0_91]
    30-5-2016 20:07:59 Caused by: java.lang.NullPointerException
    30-5-2016 20:07:59 at laurenshup.supercalculator.Calculations.Calc3Arguments(Calculations.java:14) ~[?:?]
    30-5-2016 20:07:59 at laurenshup.supercalculator.Main.onCommand(Main.java:62) ~[?:?]
    30-5-2016 20:07:59 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot-1.9.4.jar:git-Spigot-8a048fe-d8637df]
    30-5-2016 20:07:59 ... 15 more
     
    My Main Class:
    http://pastebin.com/dw613maL

    My Calculations Class:
    http://pastebin.com/F5S3a8Dx
     
  2. 30-5-2016 20:07:59 Caused by: java.lang.NullPointerException
    30-5-2016 20:07:59 at laurenshup.supercalculator.Calculations.Calc3Arguments(Calculations.java:14) ~[?:?]

    Something on line 14 is null.

    Try printing out the values of different variables till you find out which one is null.
     
  3. Thx Bimmr.
    On line 14: String playercheck = plugin.getConfig().getString("players." + player.getUniqueId() + ".lastchatcalc.out");
    was null.
    I fixed the error.
    Thread Closed
     
Thread Status:
Not open for further replies.