PlayerDeathEvent no cancellation?

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

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

    MinecraftMart

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

    Skionz

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

    Konato_K

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

    mine-care

    @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

    ColonelHedgehog

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

    mine-care

  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

    ColonelHedgehog

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

Share This Page