Trying to create a back up system if someone accidentally drops an item
Solution 1:
Using these commands (BOTH!) will prevent players from picking up any item that was dropped by a different player while allowing players to pick up items that they dropped.
/execute as @e[type=minecraft:item] if data entity @s Thrower run data modify entity @s Owner.L set from entity @s Thrower.L
/execute as @e[type=minecraft:item] if data entity @s Owner run data modify entity @s Owner.M set from entity @s Thrower.M
Using this command will set the pickup delay of dropped items to 0, so the item can be picked up imidiately and you really have to try to not pick it up:
/execute as @e[type=minecraft:item] if data entity @s Thrower run data modify entity @s PickupDelay set value 0
Using all 3 of these commands would make items really hard to accidentally get lost by dropping them. I recommend a repeating command block and then 2 chain command blocks.
If you want to be really sure that items don't get lost, then you can create a scoreboard objective that keeps track of item Owner
-tags and player UUIDs. And then teleport any item that was dropped by a player to the player who dropped it.
This is how you would set up the scoreboard objective:
/scoreboard objectives add UUIDs dummy
You would then want to set the score for all items and all players:
/execute as @e[type=minecraft:item] if data entity @s Thrower store result score @s UUIDs run data get entity @s Thrower.M 0.0000000001
/execute as @a store result score @s UUIDs run data get entity @s UUIDMost 0.0000000001
When you are done with that you can teleport all thrown items to whatever player threw it:
/execute as @e[type=item] at @a if score @s UUIDs = @p UUIDs run tp ~ ~ ~