Since the new update 1.12 I have been able to /clear @a pistons anymore as it just says "could not clear the inventory of ___ , no items to remove "even though I would have a piston in my inventory but if I try to do it with other blocks it works and in a different world its exactly the same , help
I am surprised more people are not talking about this issue. You are correct, a "/clear @a piston" command used to work in the past. However, after the recent update it is most certainly broken. We cant really just make the command work. We will have to wait for Mojang to release another patch. However, we can utilize other commands to complete the same objective. So with that being said, if your intentions are to ban pistons from a world then I have a solution for you.
SOLUTION
These two commands work together to ban pistons from a realm so that when a player tries to place one, it gets turned into air. They need to be put into repeat, unconditional, always active command blocks. A flaw, is that people will still be able to have pistons in there inventory.
1) execute @a ~ ~ ~ fill ~6 ~-3 ~-6 ~-6 ~6 ~6 air 0 replace piston -1
2) execute @a ~ ~ ~ fill ~6 ~-3 ~-6 ~-6 ~6 ~6 air 0 replace sticky_piston -1
Since the new update 1.12 I have been able to /clear @a pistons anymore as it just says "could not clear the inventory of ___ , no items to remove "even though I would have a piston in my inventory but if I try to do it with other blocks it works and in a different world its exactly the same , help
PROBLEM
SOLUTION