Discussion in 'Plugin Development' started by MinecraftMart, Jan 15, 2015.
Since when can't i cancel a players death with PlayerDeathEvent?
And is there an alternative?
@MinecraftMart Respawn the player automatically and teleport them to their old position.
@MinecraftMart As far I know you could never cancel a PlayerDeathEvent, but you can cancel the EntityDamageEvent that causes the death
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.
Remember, I think you can only respawn them with packets.
@ColonelHedgehog or set their health to 20
@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.
If you want to use the Damage event, then yes.
Separate names with a comma.