1. Create a new world in creative mode
2. Place a command block with "/gamemode 2 @a[m=0]".
3. Type "/gamemode 0" (this puts you into game mode 0)
4. Activate the command block
5. You're now in game mode 2
6 Type "/say @a[m=2]" to confirm that you're in game mode 2
7. Type "/kill"
8. Type "/gamemode 0"
9. Activate the command block
10 Type "/say @a[m=2]" to show that the server does not think you're in game mode 2.
11. Observe that the client DOES think it's in game mode 2 (can't place/break blocks).
12. Close and reopen the world.
13. Type "/say @a[m=2]" to show that the server still does not think you're in game mode 2.
14. Observe that the client no longer thinks it's in game mode 2.
confirmed and /clear @a doesn't work either. It says that the player has no items to remove, even when they do.