Couldn't pass PlayerDeathEvent

Discussion in 'Plugin Development' started by Fhbgsdhkfbl, May 24, 2016.

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

    Fhbgsdhkfbl

    Code:
    [02:50:12 ERROR]: Could not pass event PlayerDeathEvent to Kits v1.8
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:305) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.craftbukkit.v1_8_R1.event.CraftEventFactory.callPlayerDeathEvent(CraftEventFactory.java:381) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.EntityPlayer.die(EntityPlayer.java:407) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.craftbukkit.v1_8_R1.entity.CraftLivingEntity.setHealth(CraftLivingEntity.java:87) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at commands.Suicide.onCommand(Suicide.java:37) [Kits.jar:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at com.earth2me.essentials.Essentials.onCommandEssentials(Essentials.java:417) [Essentials-2.x-SNAPSHOT.jar:?]
            at com.earth2me.essentials.Essentials.onCommand(Essentials.java:402) [Essentials-2.x-SNAPSHOT.jar:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchCommand(CraftServer.java:646) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PlayerConnection.handleCommand(PlayerConnection.java:1115) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java:950) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(PacketPlayInChat.java:26) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(PacketPlayInChat.java:53) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PacketHandleTask.run(SourceFile:13) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_71]
            at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_71]
            at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:696) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:634) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:537) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at java.lang.Thread.run(Thread.java:745) [?:1.8.0_71]
    Caused by: java.lang.NullPointerException
            at me.Fhbgsdhkfbl.StatsData.onKill(StatsData.java:26) ~[?:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_71]
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_71]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_71]
            at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_71]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
            ... 25 more
    [02:50:12 ERROR]: Could not pass event PlayerDeathEvent to Kits v1.8
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:305) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.craftbukkit.v1_8_R1.event.CraftEventFactory.callPlayerDeathEvent(CraftEventFactory.java:381) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.EntityPlayer.die(EntityPlayer.java:407) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.craftbukkit.v1_8_R1.entity.CraftLivingEntity.setHealth(CraftLivingEntity.java:87) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at commands.Suicide.onCommand(Suicide.java:37) [Kits.jar:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at com.earth2me.essentials.Essentials.onCommandEssentials(Essentials.java:417) [Essentials-2.x-SNAPSHOT.jar:?]
            at com.earth2me.essentials.Essentials.onCommand(Essentials.java:402) [Essentials-2.x-SNAPSHOT.jar:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchCommand(CraftServer.java:646) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PlayerConnection.handleCommand(PlayerConnection.java:1115) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java:950) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(PacketPlayInChat.java:26) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(PacketPlayInChat.java:53) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PacketHandleTask.run(SourceFile:13) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_71]
            at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_71]
            at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:696) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:634) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:537) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at java.lang.Thread.run(Thread.java:745) [?:1.8.0_71]
    Caused by: java.lang.NullPointerException
            at me.Fhbgsdhkfbl.SB.updateSB(SB.java:64) ~[?:?]
            at me.Fhbgsdhkfbl.SB.onDeath(SB.java:56) ~[?:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_71]
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_71]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_71]
            at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_71]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
            ... 25 more
    Here's the error

    And the code on the lines:

    Line 26 of StatsData : plugin.getConfig().set("Stats." + k.getName() + ".Kills", kills + 1);


    Line 37 of suicide class: p.setHealth(0);
     
  2. Offline

    I Al Istannen

    @Fhbgsdhkfbl
    "plugin" is probably null. Have a look here.
    "k" could also be null and "kills" also (if it is an Integer and not an int. Which it shouldn't be anyways).

    There is also a NPE here:
    "at me.Fhbgsdhkfbl.SB.updateSB(SB.java:64) ~[?:?]"
     
  3. Offline

    Fhbgsdhkfbl

    @I Al Istannen
    int kills = plugin.getConfig().getInt("Stats." + p.getName() + ".Kills");

    Line 64
     
  4. Offline

    MadMaxCookie

    @Fhbgsdhkfbl check the kills if null

    Code:
    if(kills == null) {
      // do something
    }
    or make it better

    at PlayerJoinEvent

    // do this to keep the player's kill not null
    Code:
    plugin.getConfig().set("Stats." + e.getPlayer().getName() + ".Kills", 0);
     
  5. Offline

    I Al Istannen

    @Fhbgsdhkfbl
    Then plugin is probably null. Maybe the same mistake as in the other NPE, in the class StatsData. It is the same structure there.
     
Thread Status:
Not open for further replies.

Share This Page