PlayerDeathEvent no cancellation?

Discussion in 'Plugin Development' started by MinecraftMart, Jan 15, 2015.

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


    Since when can't i cancel a players death with PlayerDeathEvent?
    And is there an alternative?
  2. Offline


    @MinecraftMart Respawn the player automatically and teleport them to their old position.
  3. Offline


    @MinecraftMart As far I know you could never cancel a PlayerDeathEvent, but you can cancel the EntityDamageEvent that causes the death
  4. Offline


    @Skionz @Konato_K
    alternatively, if he wants the death event not to be called (for other plugins as well), he can use either reflection to unregister death event, also you can do more or less what @Skionz said, but instead of auto respawn, on entity damage check if the players health - damage that will be done exceeds 20 and if so perform your on respawn code.
  5. Offline


    Remember, I think you can only respawn them with packets.
  6. Offline


  7. Offline

    Forge_User_45064837 Retired Staff

    @MinecraftMart To sum up everyone.

    You have 2 options:
    1. Send packets and auto respawn the player
    2. On EntityDamageEvent check if there health is below or equal to 0 then teleport and set health to 20.

    Better explaination:
  8. Offline


    If you want to use the Damage event, then yes.
Thread Status:
Not open for further replies.

Share This Page