Development Assistance Could not pass event EntityDeathEvent -> Please HELP!

Discussion in 'Plugin Help/Development/Requests' started by xFoundation, Jun 14, 2015.

Thread Status:
Not open for further replies.
  1. Hey, i'm creating a custom bukkit plugin for my server and there are errors on the logs:

    [21:31:19] [Server thread/INFO]: Starting minecraft server version 1.8.7
    [21:31:19] [Server thread/INFO]: Loading properties
    [21:31:19] [Server thread/INFO]: Default game type: SURVIVAL
    [21:31:19] [Server thread/INFO]: Generating keypair
    [21:31:19] [Server thread/INFO]: Starting Minecraft server on *:25565
    [21:31:19] [Server thread/INFO]: Using default channel type
    [21:31:20] [Server thread/INFO]: This server is running CraftBukkit version git-Bukkit-1880a9c (MC: 1.8.7) (Implementing API version 1.8.7-R0.1-SNAPSHOT)
    [21:31:20] [Server thread/INFO]: [Game] Loading Game v0.1
    [21:31:20] [Server thread/INFO]: [HugoStats] Loading HugoStats v0.1
    [21:31:20] [Server thread/INFO]: Preparing level "world"
    [21:31:20] [Server thread/INFO]: Preparing start region for level 0 (Seed: 0)
    [21:31:20] [Server thread/INFO]: Preparing start region for level 1 (Seed: 0)
    [21:31:21] [Server thread/INFO]: Preparing start region for level 2 (Seed: -1575560157028647967)
    [21:31:21] [Server thread/INFO]: [Game] Enabling Game v0.1
    [21:31:21] [Server thread/INFO]: [HugoStats] Enabling HugoStats v0.1
    [21:31:21] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [21:31:21] [Server thread/INFO]: Done (1,083s)! For help, type "help" or "?"
    [21:33:25] [User Authenticator #1/INFO]: UUID of player HugoFLP is d9f0a68c-ae2c-4af0-9423-fa2264cdc690
    [21:33:25] [Server thread/INFO]: HugoFLP[/] logged in with entity id 249 at ([world]-135.3634836417522, 4.0, 16.706226510475247)
    [21:33:44] [Server thread/ERROR]: Could not pass event EntityDeathEvent to HugoStats v0.1
        at$1.execute( ~[server.jar:git-Bukkit-1880a9c]
        at org.bukkit.plugin.RegisteredListener.callEvent( ~[server.jar:git-Bukkit-1880a9c]
        at org.bukkit.plugin.SimplePluginManager.fireEvent( [server.jar:git-Bukkit-1880a9c]
        at org.bukkit.plugin.SimplePluginManager.callEvent( [server.jar:git-Bukkit-1880a9c]
        at org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory.callEntityDeathEvent( [server.jar:git-Bukkit-1880a9c]
        at org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory.callEntityDeathEvent( [server.jar:git-Bukkit-1880a9c]
        at net.minecraft.server.v1_8_R3.EntityLiving.die( [server.jar:git-Bukkit-1880a9c]
        at net.minecraft.server.v1_8_R3.EntityZombie.die( [server.jar:git-Bukkit-1880a9c]
        at net.minecraft.server.v1_8_R3.EntityLiving.damageEntity( [server.jar:git-Bukkit-1880a9c]
        at net.minecraft.server.v1_8_R3.EntityMonster.damageEntity( [server.jar:git-Bukkit-1880a9c]
        at net.minecraft.server.v1_8_R3.EntityZombie.damageEntity( [server.jar:git-Bukkit-1880a9c]
        at net.minecraft.server.v1_8_R3.EntityHuman.attack( [server.jar:git-Bukkit-1880a9c]
        at net.minecraft.server.v1_8_R3.EntityPlayer.attack( [server.jar:git-Bukkit-1880a9c]
        at net.minecraft.server.v1_8_R3.PlayerConnection.a( [server.jar:git-Bukkit-1880a9c]
        at net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.a(SourceFile:52) [server.jar:git-Bukkit-1880a9c]
        at net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.a(SourceFile:11) [server.jar:git-Bukkit-1880a9c]
        at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$ [server.jar:git-Bukkit-1880a9c]
        at java.util.concurrent.Executors$ Source) [?:1.8.0_11]
        at Source) [?:1.8.0_11]
        at net.minecraft.server.v1_8_R3.SystemUtils.a( [server.jar:git-Bukkit-1880a9c]
        at net.minecraft.server.v1_8_R3.MinecraftServer.B( [server.jar:git-Bukkit-1880a9c]
        at net.minecraft.server.v1_8_R3.DedicatedServer.B( [server.jar:git-Bukkit-1880a9c]
        at net.minecraft.server.v1_8_R3.MinecraftServer.A( [server.jar:git-Bukkit-1880a9c]
        at [server.jar:git-Bukkit-1880a9c]
        at Source) [?:1.8.0_11]
    Caused by: java.lang.NullPointerException
        at fr.hugo.main.Main.onEntityDeath( ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
        at$1.execute( ~[server.jar:git-Bukkit-1880a9c]
        ... 24 more
    [21:33:50] [Server thread/INFO]: Stopping the server
    [21:33:50] [Server thread/INFO]: Stopping server
    [21:33:50] [Server thread/INFO]: [HugoStats] Disabling HugoStats v0.1
    [21:33:50] [Server thread/INFO]: [Game] Disabling Game v0.1
    [21:33:50] [Server thread/INFO]: Saving players
    [21:33:50] [Server thread/INFO]: HugoFLP lost connection: Server closed
    [21:33:50] [Server thread/INFO]: HugoFLP left the game.
    [21:33:50] [Server thread/INFO]: Saving worlds
    [21:33:50] [Server thread/INFO]: Saving chunks for level 'world'/Overworld
    [21:33:50] [Server thread/INFO]: Saving chunks for level 'world_nether'/Nether
    [21:33:50] [Server thread/INFO]: Saving chunks for level 'world_the_end'/The End
    Here the code for my scoreboard when adding +1 by an event.

     package fr.hugo.main;
    import java.util.HashMap;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.Player;
    import org.bukkit.entity.Zombie;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.EntityDeathEvent;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.scoreboard.DisplaySlot;
    import org.bukkit.scoreboard.Objective;
    import org.bukkit.scoreboard.Score;
    import org.bukkit.scoreboard.Scoreboard;
    public class Main extends JavaPlugin implements Listener {
        private Scoreboard board;
        private Objective o;
        private HashMap<String, Integer> kills = new HashMap<String, Integer>();
        public void onEnable() {
                Bukkit.getServer().getPluginManager().registerEvents(this, this);
                board = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
                o = board.registerNewObjective("test", "dummy");
                o.setDisplayName(ChatColor.WHITE + "Stats");
                Score score = o.getScore(ChatColor.WHITE + "Kills:");
        public void onPlayerJoin(PlayerJoinEvent playerJoinEvent) {
            Player eventPlayer = playerJoinEvent.getPlayer();
        public void onEntityDeath(EntityDeathEvent e) {
            Entity en = e.getEntity();
            if (en instanceof Zombie) {
                if (((Zombie) en).getKiller() instanceof Player) {
                    Player p = ((Zombie) en).getKiller();
                        kills.put(p.getName(), kills.get(p.getName()) + 1);
    Please help me !
  2. Offline


    @xFoundation the stack trace seems a bit offset, anyway, you're using kills.get() to ge the previous value, however, assuming it's the first time the player kills a zombie this will return null, causing an NPE
  3. Offline


    @xFoundation i'm not sure how work this event. If it's called when a player kill an entity or just when an entity die. If it's the second option, the method getKiller might return null cuz it returns always a player.
  4. Anyone have bug fixes plz ?

    ? Please

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 12, 2016
Thread Status:
Not open for further replies.

Share This Page