Stop all players from dropping any items

minecraft-commandsminecraft-java-edition

We are creating a kit-based PvP map for Christmas. Players will be able to select a kit to fight with. Using /gamerule keepInventory false we can prevent players from dropping items on their death, however, players are still able to drop items in general. This is a problem because players could pick a kit, drop their items, and then pick a different kit. This way they are able to equip many kits at once, which is obviously unintended.

We do not want to clear all items that are on the floor in a loop, since players might accidentally drop their item when in a panic.

Setting the PickupDelay of all items to 0 also does not work as you are still able to share items with other players this way by standing really closely to each other.

How do we prevent players from dropping any and all items?

Best Answer

It seems to be possible to specify who dropped the item, for every entity that is dropped. Using command blocks you can set the item to only be able to be picked up by the actual owner of that item.

It is very well explained in this video, starting at 1:43 (timestamped for your convenience)