Minecraft RCON Commands

Posted on

In Minecraft, you may wonder how the Minecraft command works on servers. As we know that commands in Minecraft are advanced features which can be activated by typing certain strings of the text. Of course, to know how commands run in Minecraft, you have to try using it when playing Minecraft.

Moreover, commands will appear when you enter via the chat window. Certainly, it will be displayed by pressing the T key (default) or, in Java Edition, / key. Then, the ↑ and ↓ keys are generally used to see previous entered text. By pressing Tab ↹ while you enter commands or arguments, certainly it can be used to auto-enter the coor-dinates of the block before entering the chat.

Then, in Minecraft, you will be familiar with RCON.

Yeah… RCON is a Minecraft protocol that allows the server administrators to execute Minecraft commands.

The general use of RCON here is to allow server owners to control their game servers without direct access to the machine when the server is running on. So that the Minecraft commands to be accepted, of course, the connection has first to be authenticated when using the server’s RCON password. Furthermore, it can be set using the console variable rcon_password.

Request and Response in RCON Commands

In RCON, you can also find requests and responses which are really important to know.


The first packet which is sent by the client will be a SERVERDATA_AUTH packet. It is used to authenticate the connection with the server. When rcon_password cvar is not set, automatically SERVERDATA_AUTH requests will be rejected.


This packet represents a command which is issued to the server by a client. It can be a ConCommand like mp-switchteams or changelevel. This will vary based on the command issued.


This SERVERDATA_AUTH_RESPONSE is a kind of notification of connection’s current auth status. In this case, when the server receives an auth requests, it automatically will respond with an empty SERVERDATA_RESPONSE_VALUE which is followed by a SERVERDATA_AUTH_RESPONSE. Of course, it indicates whether the authentication succeeded or failed.


This packet is a response to a SERVERDATA_EXECOMMAND request. Need to know that the long responses will probably be sent in multiple SERVERDATA_RESPONSE_VALUE packet.

Here are some commands that you can find in Minecraft RCON:

Connect: eval { $rcon->connect }; # $@ will be set on error

Connected: say “We are connected!” if $rcon->connected;

Disconnect: $rcon->disconnect;

Command ($command, [$color_mode]):

  • my $response = $rcon->command(“data get block $x $y $z”);
  • my $ansi = $rcon->command(‘list’, ‘convert’);

color_mode( $color_mode, [ $code ] ): $rcon->color_mode(‘strip’);

Example usage:

# Color mode is ‘convert’

$rcon->color_mode(strip => sub {

    my $plaintext = $rcon->command(‘…’);


color_convert( $string, [ $color_mode ] ):

my $response = $rcon->command(‘list’);

my ($strip, $ansi) = map { $rcon->color_convert($response, $_) }

qw<strip convert>;


eval { $result = $rcon->command(‘list’); };

warn “I don’t know who is online because: $@” if $@;\

Try::Tiny instead:

use Try::Tiny;

try {

    $result = $rcon->command(‘list’);

} catch {

    warn “I don’t know who is online because: $_”;


Leave a Reply

Your email address will not be published. Required fields are marked *