Option to stop Restore Upon Death when user has LifeSupport activeSolved

When LifeSupport is active, when players hit 0 HP, items still get removed then LifeSupport kicks in.

If players have LifeSupport on, it would be great to not remove the items when their health goes to 0 or below

It appears that this issue can be resolved by updating Restore Upon Death from using the OnPlayerDeath hook to use the OnEntityDeath hook instead, which is only called if the player is actually being killed. This is because these two plugins have different concerns.

  • Life Support is concerned with potentially blocking death (pre-death)
  • Restore Upon Death is concerned with detecting player death (post-death)
This follows the typical pre/post hook pattern, so updating Restore Upon Death to use the post hook variation should solve the issue, though I haven't tested it. If you want to try this change, simply rename OnPlayerDeath -> OnEntityDeath on line 43 of RestoreUponDeath.cs and let us know if that works.
WXDvNwlC1aqEcjV.jpg WhiteThunder

It appears that this issue can be resolved by updating Restore Upon Death from using the OnPlayerDeath hook to use the OnEntityDeath hook instead, which is only called if the player is actually being killed. This is because these two plugins have different concerns.

  • Life Support is concerned with potentially blocking death (pre-death)
  • Restore Upon Death is concerned with detecting player death (post-death)
This follows the typical pre/post hook pattern, so updating Restore Upon Death to use the post hook variation should solve the issue, though I haven't tested it. If you want to try this change, simply rename OnPlayerDeath -> OnEntityDeath on line 43 of RestoreUponDeath.cs and let us know if that works.
I will give it a go and let you know.

I was also starting to read the list of ID's from the LifeSupport data file and returning null if present for current player, but a function rename would be much easier.   Stay tuned and thank you for your wisdom WhiteThunder
Avd0VZyjsBfpaVG.jpg WhiteThunder

It appears that this issue can be resolved by updating Restore Upon Death from using the OnPlayerDeath hook to use the OnEntityDeath hook instead, which is only called if the player is actually being killed. This is because these two plugins have different concerns.

  • Life Support is concerned with potentially blocking death (pre-death)
  • Restore Upon Death is concerned with detecting player death (post-death)
This follows the typical pre/post hook pattern, so updating Restore Upon Death to use the post hook variation should solve the issue, though I haven't tested it. If you want to try this change, simply rename OnPlayerDeath -> OnEntityDeath on line 43 of RestoreUponDeath.cs and let us know if that works.

Just tested with the OnEntityDeath function instead of the OnPlayerDeath function. 
You were 100% right - no issues when LifeSupport was on.

when LifeSupport was off, i died and my inventory was removed to 75% (which is what was in the config for this plugin).

You never cease to amaze with your skillset.  Thank you @WhiteThunder!



Merged post

One small issue...with the two Plugins running and NOT having the permission for RestoreUponDeath, whatever is in your hand still gets removed if you die with LifeSupport on.  

Merged post

Needed to add a permission check to the ShouldBlockRestore function (probably should've been there to begin with):

private bool ShouldBlockRestore(BasePlayer player) => Interface.Call("isEventPlayer", player) != null || Interface.Call("OnRestoreUponDeath", player) != null || !HasAnyPermission(player.UserIDString);
Locked automatically