1. Guest, as per the stickied thread, this forum has not been in use since 2014. All bugs and feature requests should be posted to JIRA.

Feature [API] PlayerDeathEvent

Discussion in 'Bugs & Feature Requests' started by DevHill, May 22, 2015.

  1. Hello,
    Currently, PlayerDeathEvent is not very practical. We can not get the reason, the entity who killed the player, ... (without reading the message; but it isn't practical). It's working but it can be better, I think. I was thinking at methods like :

    Code (Text):

    public DeathReason getDeathReason();
    public Entity getDamager(); // can be null
    public boolean deathWhilstFighting();
    public Entity wasFighting(); // can be null
     
    If you think that it's useful, I hope that it could be add ! ;)
     
  2. @EventHandler
    public void PlayerDeathEvent(PlayerDeathEvent e){

    if(e.getEntity() instanceof Player){
    Bukkit.getServer().getConsoleSender().sendMessage(e.getEntity().getLastDamageCause().toString());
    }
    }
     
  3. I already use that in my plugins but it isn't very practical. Moreover, it provide no way to get that :
    Code (Text):
    public boolean deathWhilstFighting();
    public Entity wasFighting();
    I know that there is argument against this idea, but this is an improvement which simplify the API and add possibilities, so ...
     
  4. Why we need the same but easier explained if we already have it -_-
     
    • Optimistic Optimistic x 1
  5. Just check if the player was dealing damage when he died.