Direct answer

On a Java dedicated server, set enable-command-block=true in server.properties and restart the server. Operators can then give themselves a command block with /give @s minecraft:command_block.

Recommended procedure

  1. Stop the server cleanly and back up server.properties.
  2. Set enable-command-block=true without adding duplicate keys, then save the file.
  3. Restart and check startup logs for configuration errors.
  4. As an operator, run /give @s minecraft:command_block in-game, place the block, and test a harmless command.
  5. Keep command-block access restricted to trusted operators because commands can change world state and player permissions.

Why this matters

Having command blocks in an inventory does not mean the dedicated server is configured to execute them. A plugin or modern Java game rule may also impose separate restrictions.

How to verify the result

Place a test command block and check its output. If it does not work, inspect server.properties, the exact Java version, current game-rule identifiers, permissions, and any plugin filtering command execution.

Version and compatibility notes

Mojang changed several game-rule identifiers in Java 1.21.11, including the command-block rule. Use the identifiers exposed by your running server rather than copying legacy command examples.

Official references

Was this article helpful?
Help us improve this article

Tell us what is missing, unclear, outdated, or incorrect. You can also suggest something we should add.

What could we improve?
Do not include passwords, server IPs, or other private information.0 / 1000