There’s no command that does this. You could build a big command block system that either deletes items that are in stacks of 2+ or spreads them out (which would be problematic in a full inventory) or whatever.
How do you stack command blocks?
To make your command block run multiple commands, you will need to summon FallingSand or falling_block (depending on your version of Minecraft) with command blocks and redstone blocks for each command. The command blocks will be stacked one on top of the other and contain the individual command.
How can I prevent updates to stack resources?
During an update, some resources might require an interruption or be completely replaced, resulting in new physical IDs or completely new storage. You can prevent stack resources from being unintentionally updated or deleted during a stack update by using a stack policy.
How are resources protected in a stack policy?
After you set a stack policy, all of the resources in the stack are protected by default. To allow updates on specific resources, you specify an explicit Allow statement for those resources in your stack policy. You can define only one stack policy per stack, but, you can protect multiple resources within a single policy.
How do you set a stack policy in Java?
You set the stack policy when you create a stack, by specifying a text file that contains your stack policy or typing it out. When you set a stack policy on your stack, any update not explicitly allowed is denied by default. You define a stack policy with five elements: Effect , Action, Principal, Resource, and Condition.
Can a command block be set via command block?
Blocks cannot be placed or destroyed in this area, unless you’re an OP (and at least one OP must be listed in order for it to work). Note that it is currently not possible to fully prevent the griefing you described above in vanilla without tampering with the user’s inventory or use of modding tools. Can spawn-protection be set via Command Block?