We all have lost that enchanted armour set or a efficiency v pickaxe in lava once. It's painful to see that item that consumed so many resourced to craft be destroyed by lava.
I was thinking about a set of command blocks that will retrieve any NAMED ITEM from your inventory once you die, and return it to your inventory upon respawning. Any other items will be dropped to the ground, waiting for you to pick them back or be destroyed by lava.
Is it possible to create such a mechanism?
If possible, I'd love to see that the recovered items would suffer a 20% durability loss, in order to discourage the user from not caring about death.
I am familiar with the
/gamerule keepInventory true command, but I find it highly overpowered, and which makes death a mere nuisance rather than something to be feared.
 No mods... this is a vanilla server.