When I was trying to fix my plugin I noticed that since last Rocket and Unturned update on 5th March OnPlayerDeath and OnPlayerDied events are called at the same time (they replicate Unturned native PlayerLife.onPlayerDied event).
Before this update OnPlayerDeath (tellDeath) was always called before OnPlayerDied (tellDied), so we could access player inventory before it was dropped (tellDead triggers PlayerLife.onLifeUpdated event which is used then by PlayerInventory to clear items when player dies).
This causes all plugins that look through player inventory when he died stop working.
I think OnPlayerDeath event should be called separately from OnPlayerDied and before native onLifeUpdated event trigger. Maybe it would be a good idea to add a native event for Unturned onBeforePlayerDied, since using triggerSend is deprecated.
Hmm interesting case. tellDeath was only sent to owner for UI purposes, so it is unfortunate plugins were depending on it that way. I will add a pre-death event for this in the next update.
Hey,
When I was trying to fix my plugin I noticed that since last Rocket and Unturned update on 5th March
OnPlayerDeath
andOnPlayerDied
events are called at the same time (they replicate Unturned native PlayerLife.onPlayerDied event).Before this update OnPlayerDeath (tellDeath) was always called before OnPlayerDied (tellDied), so we could access player inventory before it was dropped (tellDead triggers PlayerLife.onLifeUpdated event which is used then by PlayerInventory to clear items when player dies).
This causes all plugins that look through player inventory when he died stop working.
I think
OnPlayerDeath
event should be called separately from OnPlayerDied and before native onLifeUpdated event trigger. Maybe it would be a good idea to add a native event for UnturnedonBeforePlayerDied
, since using triggerSend is deprecated.https://github.com/SmartlyDressedGames/Legally-Distinct-Missile/blob/7db696724d20664053ab1c0527cfcfe5487285d7/Rocket.Unturned/Events/UnturnedPlayerEvents.cs#L186
Thanks