You can’t directly roll back the
kill action of a player to get their items back, but you can roll back the items that they dropped in the area when they died. This would work regardless of what happened to the items after they died, whether they burned, fell into the void, were taken by another player, just despawned, or a mix of them all.
You need to know the location that the player died, and then you’ll need to perform a lookup to make sure that the item drops were logged. In the image to the right you can see that I died to fire and then dropped a number of items. You’ll need to run a lookup command to target just the item drops using the
I used the following command to target all of the negative inventory transactions within 5 blocks of where I died. I ran the command while standing in the location, but there are other ways of defining the selection.
/co lookup user:mov51 action:-inventory radius:5 time:15m
item action shown next to each entry is the more general action that covers
inventory transactions. This action can not be rolled back and you need to use the more specific inventory action.
To get the items back, all you have to do now is replace
rollback and the items will be returned to the player’s inventory.
Make sure the player has space in their inventory for the items! Any items that the player doesn’t have space for will not be returned.