Minecraft – way to hide commands by a player

minecraft-commandsminecraft-java-editionminecraft-java-edition-server

I have a realm with a few of my friends and i want to play the creeper primed sound at him but i am afraid he will see the command and ignore it

Im using: /playsound minecraft:entity.creeper.primed block

Version: 1.14.2

Best Answer

Only operators can see command output from players.

If the victim of the prank is an operator (has access to cheat commands), they will see an output message. If you demote them to a regular player, they will not see it in the chat.

If for any reason you cannot or don't want to demote a player, you can give yourself a command block, set the commandBlockOutput gamerule to false:

/gamerule commandBlockOutput false

And now, if you run your command through the command block, no one will be able to see the output in chat. However, the /give and /gamerule commands you did will still be visible in chat.