Solved How to fix console error?

Discussion in 'Plugin Development' started by makcoh2018, Jul 5, 2021.

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

    makcoh2018

    I have a problem with my code. I have event on kill player and i have error when i use /kill or suicide. How am i can fix this?

    Code:
    Code:
        @EventHandler
        public void Kill(PlayerDeathEvent e){
            Player p = e.getEntity().getKiller();
            UUID uuid = p.getUniqueId();
            if (e.getEntity().getKiller() != null) {
                addKills(uuid,1);
            }
            updateScoreboard(p);
        }
    My Error:
    ERROR (open)

    [19:04:51 ERROR]: Could not pass event PlayerDeathEvent to msql v1
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory.callPlayerDeathEvent(CraftEventFactory.java:396) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at net.minecraft.server.v1_8_R3.EntityPlayer.die(EntityPlayer.java:417) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity.setHealth(CraftLivingEntity.java:87) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at me.testmsql.PrisonPlayer.CommandKill.onCommand(CommandKill.java:13) [msqltest.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1162) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:997) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_281]
    at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_281]
    at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:715) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot.jar:git-Spigot-e4d4710-e1ebe52]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_281]
    Caused by: java.lang.NullPointerException
    at me.testmsql.PrisonPlayer.PrisonPlayer.Kill(PrisonPlayer.java:147) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_281]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_281]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_281]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_281]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-e4d4710-e1ebe52]
    ... 23 more
    [19:04:51 INFO]: 22X22 died
     
  2. Offline

    timtower Administrator Administrator Moderator

    @makcoh2018 There might not be a killer, certainly does not need to be a player.
     
  3. Offline

    makcoh2018

    How to make check on if not a killer?
     
  4. Offline

    timtower Administrator Administrator Moderator

    @makcoh2018
    if (e.getEntity().getKiller() != null) {
    Like you are doing.
     
  5. Offline

    makcoh2018

    It's doesn't work. I have error in my console when i use this
     
  6. Offline

    timtower Administrator Administrator Moderator

    Because it isn't the first check you are doing.
     
  7. Offline

    makcoh2018

    I don't know how to make check on kill or suicide. Can you help me?
     
Thread Status:
Not open for further replies.

Share This Page