A simple Mod/Datapack where only people with the 'keepinv' tag keep the items.
With the Mod/Datapack you can give players a tag with which they can keep the items after death.
If you find any bugs or have any datapack suggestions, please let me know on my Discord.
You can tag players with
/tag [PlayerName] add KeepInv
and remove it with
/tag [PlayerName] remove KeepInv