Help With PlayerDeathEvent

Discussion in 'Plugin Development' started by ConnerYOLO, Nov 24, 2014.

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

    ConnerYOLO

    Can someone help me with this, I'm getting a load of errors and don't know where i've gone wrong. I need help from a pro as I'm only learning. I want it to recognise when a player has killed another player.
    @EventHandler
    public void onKill(PlayerDeathEvent e){
    if(e.getPlayer() instanceof Player){
    Player m = (Player) e.getPlayer();
    if(m.getKiller() instanceof Player){
    Player p = m.getKiller();
    }
    }
    }
     
  2. Offline

    mine-care

    1. e.getPlayer() does not exist as a method in PlayerDeathEvent, it is e.getEntity() instead.
    2. no reason to cast to player since PLAYER death event returns player
    3. it would be good to use code brackets in forums [CODE} {/CODE] (with [ instead of { )
    4. Please post errors as well in your posts :)
    5. Please learn the basics of java before starting with bukkit.
     
  3. Offline

    JordyPwner

    NINJAD! LOL
     
    mine-care likes this.
Thread Status:
Not open for further replies.

Share This Page