# How to Enable Command Blocks on Your Minecraft Server (/docs/minecraft/command-blocks)



import { Step, Steps } from 'fumadocs-ui/components/steps';

Command blocks are special blocks that execute commands when powered by redstone. They're disabled by default on multiplayer servers because any player who can place one can run almost any command. Enable them deliberately, and only on servers where all OPs are trusted.

Enable Command Blocks [#enable-command-blocks]

<Steps>
  <Step>
    Stop the server [#stop-the-server]

    In the [XGamingServer Panel](https://panel.xgamingserver.com), open **Console** and stop your server.
  </Step>

  <Step>
    Edit server.properties [#edit-serverproperties]

    Click **Files** in the sidebar and open `server.properties`. Find:

    ```properties
    enable-command-block=true
    ```

    Click **Save Content**.
  </Step>

  <Step>
    Start the server [#start-the-server]

    Start from **Console**. Command blocks are now functional.
  </Step>
</Steps>

Get a Command Block [#get-a-command-block]

Command blocks **cannot be obtained in survival** — even creative mode requires the give command. Run in chat or console:

```
/give @p command_block
```

You must be **OP level 2 or higher** to run this command. See [OP Permissions](/docs/minecraft/op-permissions).

Command Block Types [#command-block-types]

Right-click a placed command block to switch its mode:

| Type        | Color  | When it runs                                           |
| ----------- | ------ | ------------------------------------------------------ |
| **Impulse** | Orange | Once per redstone pulse                                |
| **Chain**   | Green  | When the command block behind it runs (chain reaction) |
| **Repeat**  | Purple | Every tick (20×/second) while powered                  |

Each can be set to **Conditional** (only runs if previous block succeeded) or **Unconditional**, and **Needs Redstone** or **Always Active**.

Permissions [#permissions]

| Action                            | Required OP level     |
| --------------------------------- | --------------------- |
| Place / break command blocks      | 2+                    |
| Edit command in command block GUI | 2+                    |
| Trigger an existing command block | Anyone (via redstone) |

Set the default OP level in `server.properties` with `op-permission-level=2`.

Security Warning [#security-warning]

> **Command blocks can run nearly any command**, including `/op`, `/give`, `/gamemode`, and `/execute`. A malicious player with build access can use them to grant themselves OP, give items, or wipe the world. **Only enable on servers where:**
>
> * All players with build access are trusted, **or**
> * You use a region protection plugin (WorldGuard, GriefPrevention) to block command-block placement outside admin areas

Common Issues [#common-issues]

| Problem                                         | Fix                                                                                           |
| ----------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `/give @p command_block` says "unknown command" | You're not OP, or your OP level is below 2. Run `/op <yourname>` from console                 |
| Command block placed but does nothing           | Not powered by redstone, or set to "Needs Redstone" without input — switch to "Always Active" |
| "Cannot place command block"                    | `enable-command-block=false` is still set, or the server wasn't restarted                     |
| Chain command blocks not firing                 | Chain blocks must point *away* from the impulse block, and the impulse must succeed           |
| Repeating command blocks lagging the server     | Reduce tick rate by gating with redstone, or use `/execute if` conditions to skip work        |

Related Guides [#related-guides]

* [Server Properties](/docs/minecraft/server-properties)
* [OP Permissions](/docs/minecraft/op-permissions)
* [Set Gamemode](/docs/minecraft/set-gamemode)
