TechnicallyCoded / Inventory-Rollback-Plus

Spigot/Bukkit plugin that allows server moderators to restore player items and data from backups.
https://www.spigotmc.org/resources/85811/
Other
66 stars 44 forks source link

Switch to PlayerDeathEvent instead of using EntityDamageEvent #131

Open Nononitas opened 1 year ago

Nononitas commented 1 year ago

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 commented 1 year ago

Pull request #132

TechnicallyCoded commented 1 year ago

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..

Nononitas commented 1 year ago

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