Keep inventory and Keep Levels

Hi,

I didnt find a way to keep the inventory or players levels on death. Listening to “DestructEntityEvent.Death” does have this methods or similar.

Is there a way to keep itens and xp of player for now?
Thanks.

Here’s some example code of how I’m storing player inventory on death in one of my plugins I started a while back, though probably not in the way you’re wanting. I imagine you could do something similar where you instead save the player’s inventory along with experience on the death event and restore it on respawn.

Exact… i tryng to use RespawnPlayerEvent, when i can get the original player, and the new player and i can check if the cause of respawn is death.

I dont tested but i will try to copy one inventory to other.

Edit: I was using iterator, but your example using forEach seems better, thanks ^^

I found the event “HarvestEntityEvent.TargetPlayer” but seems is not fired after DestructEntityEvent like is in javadocs :disappointed:

Probably not implemented then

1 Like