This article will show you how to enable and use command blocks on your Minecraft server.
Also, please note that to be able to use command blocks you need to be in creative, which can be done by using the following command:
/gamemode creative
❓ What Are Command Blocks ❓
Command blocks are actual in-game blocks that can execute commands. So you can let a block run a command instead of yourself.
Note that command blocks can not be obtained through survival, but only in creative.
Enabling Command Blocks In Your Server
Command Blocks are disabled by default. You can enable them in your server settings:
- Log in to your Pterodactyl panel here and stop your server.
- Click on
Server Properties
and toggleEnable-command-block
.
- Click on
Save
and Start your server.
Getting a Command Block
There is no way to craft a command block, so you need to use the “give” command from Minecraft but depending on the version you run the command format can change.
- For version below 1.12 (ex. 1.8, 1.9, 1.10, 1.11, 1.12) you need enter the command to give someone a command block.
/give <player_name> 137
Replace <player_name>` with the username of the player.
- For version above 1.12 (ex. 1.13, 1.14, 1.15, 1.16) you need enter the command to give someone a command block.
/give <player_name> minecraft:command_block
Replace <player_name>` with the username of the player.
In this example, we used @p
in Minecraft to give ourselves a command block.
Example: /give @p minecraft:command_block
Using Target Selectors With Command Blocks
A target selector is a syntax used to target a player or entity in Minecraft.
- @p – Targets the nearest player.
- @r – Targets a random player.
- @a – Targets all players.
- @e – Targets all entities.
- @s – Target yourself.
Commandhook Plugin
This plugin adds the possibility to use vanilla selectors in non-vanilla commands written in CommandBlock. More info regarding this plugin can be found here.
To install this plugin into your server you need to do the following:
- Download the plugin from its official page here.
- Use Filezilla to upload the plugin to your server
plugins
folder.
- Restart your server.
You just set up the Commandhook plugins into your server.