Inventory-Rollback-Plus icon indicating copy to clipboard operation
Inventory-Rollback-Plus copied to clipboard

Switch to PlayerDeathEvent instead of using EntityDamageEvent

Open Nononitas opened this issue 2 years ago • 3 comments

What is missing:

Currently you are using the EntityDamageEvent to check if a player dies, rather then using the PlayerDeathEvent. The problem with this approach is that for example custom deaths from plugins won't get saved.

Specific changes to make:

Switch to PlayerDeathEvent and get the information for the death cause via event.getEntity().getLastDamageCause() (can be null)

Nononitas avatar Jun 06 '23 22:06 Nononitas

Pull request #132

Nononitas avatar Jun 06 '23 23:06 Nononitas

Thanks for feeling inclined to contribute. I made the change to use the damage event a while ago because there was a specific scenario where the death event was insufficient... Tbh I don't really remember why anymore but I'll try to remember. It was some weird condition where the death wouldn't get logged, I think..

TechnicallyCoded avatar Jun 07 '23 06:06 TechnicallyCoded

If a death event doesn't get fired, it's more of a bukkit bug.

Nononitas avatar Jun 07 '23 17:06 Nononitas