Share

Share

Commands

From Minecraft Wiki
(Redirected from Server commands)
Jump to: navigation, search

Commands are advanced functions activated by typing certain strings of text.

Usage[edit]

In a regular Minecraft client or the stand alone client, commands are entered via Minecraft's chat window, which is displayed by pressing the T key (default) or / key. Using the / key will also enter the forward slash that commands require as a prefix, so it is a useful shortcut. Pressing Tab ↹ while entering commands cycles through possible commands or arguments.

Commands may also be entered in a multiplayer server's console, but are not preceded by a / when entered this way. Commands in command blocks can be preceded by a slash, but it is not required. Commands in a command block may also require an optional argument, usually a player's username.

The majority of commands are only available in the following situations:

  • In a Minecraft multiplayer server game, entered by an operator or command block.
  • In other multiplayer games, entered by the player who opened a LAN game with cheats enabled, or is hosting their own multiplayer server
  • In singleplayer, if cheats were enabled at world creation (via the "More World Options..." button).

Some player commands are also available in singleplayer even when cheats are not enabled.

Note: In singleplayer worlds where cheats were not enabled at creation, they can be enabled on a temporary basis by opening the current game session to LAN play ( Esc -> "Open to LAN", then "Allow Cheats" button and "Start LAN World"). You do not actually need to be on a LAN or have others join. This is not permanent, but will allow the use of commands until you quit the world, and changes you make via commands (items spawned, etc.) will be saved with the world. You can do this each time you start playing the world again. Note that this will disable game pausing for the duration, so while open to LAN, you should get somewhere safe or reload your world before using the Game Menu. Remember that you can disable your LAN world by reloading the world.

Tilde notation[edit]

Many commands allow relative coordinates to be specified using tildes (~). A number following a tilde is an offset from something rather than a coordinate. The sign of the offset specifies whether to go in the positive or negative direction for that axis. A single tilde by itself is shorthand for ~0.

For example, tp 0 64 0 will teleport the user to the coordinate (0, 64, 0), while tp ~3 ~ ~-3 will teleport the user to a position +3 blocks in the "x" direction (i.e., east), keep their current height, and -3 blocks in the "z" direction (i.e., north).

Usually absolute coordinates can be mixed with relative coordinates. For example, tp ~ 64 ~ will keep the user's "x" and "z" coordinates the same, but teleport them to absolute height 64.

The origin for the offset depends on the command. For example, for /tp the offset is from the starting position. Other common offsets include from the position of the command's execution or from another coordinate specified by the command.

Target selectors[edit]

In most commands where a player may be specified as an argument, it is possible to "target" one or more players satisfying certain conditions instead of specifying players by name. To target players by condition, choose a target selector variable and, optionally, one or more target selector arguments to modify the conditions to be satisfied.

For example, to change the game mode of all players on team Red to creative mode, instead of specifying them by name individually:

/gamemode creative @a[team=Red]


Target selector variables[edit]

Summary of target selector variables
Variable Function
@p nearest player
@r random player
@a all players
@e all entities

A target selector variable identifies the broad category of targets to select. There are four variables:

@p
Targets the nearest player. If there are multiple nearest players, caused by them being precisely the same distance away, a player is selected by the time the player most recently joined the server.
Target selector arguments may be used to reduce the set of players from which the nearest player will be selected. For example, @p[team=Red] will target the nearest player on team Red even if there are other players closer.
The c target selector argument can be used to increase the number of nearest players targeted (for example, @p[c=3] will target the three nearest players). When negative, c will reverse the order of targeting (for example, @p[c=-1] will target the farthest player).
@r
Targets a random player (or entity with the type target selector argument).
Target selector arguments may be used to reduce the set of players from which a random player will be targeted. For example, @r[team=Red] will only target a random player from team Red.
The c target selector argument can be used to increase the number of random players targeted. For example, @r[c=3] will target three random players.
When used without the type argument, @r always targets a random player. The type argument can be used to target non-player entities (for example, @r[type=Zombie] will target a random zombie, @r[type=!Player] will target a random non-player entity, @r[type=!Zombie] will target a random non-zombie, etc.).
@a
Targets all players.
Target selector arguments may be used to reduce the set of players targeted. For example, @a[team=Red] will only target players on team Red.
@e
Targets all entities (including players).
Target selector arguments may be used to reduce the set of entities targeted. For example, @e[type=Cow] will only target cows.


Target selector arguments[edit]

Summary of target selector arguments
Argument(s) Selection criteria
x, y, z coordinate
r, rm radius (max, min)
m game mode
c count
l, lm experience level (max, min)
score_name max score
score_name_min min score
team team name
name player name
dx, dy, dz volume dimensions
rx, rxm vertical rotation (max, min)
ry, rym horizontal rotation (max, min)
type entity type

After using a target selector, you can optionally use arguments to modify the set of targets selected. When used with @a or @e, arguments narrow down the number of targets from the full list to a specific few. When used with @p or @r, arguments narrow the number of targets down from the full list to a smaller set from which the nearest or random player is selected.

Add argument-value pairs as a comma-separated list contained within square brackets after the target selector variable:

@<variable>[<argument>=<value>,<argument>=<value>,…].

Spaces are not allowed around the brackets, equal signs, or commas, and only commas may be used to separate argument-value pairs.

Arguments are case-sensitive and unsupported arguments are silently ignored. For example, kill @e[type=Creeper,r=20] will kill all creepers in a 20-block radius, but kill @e[Type=Creeper,r=20] ('type' capitalized) will kill all entities (including players) in that radius because there is no longer an argument limiting the targets to just creepers.

If the first few arguments (up to four) are specified simply as values without identifying the arguments, they are assumed to be, in order, x, y, z, and r. Thus, the following two commands are identical:

/gamemode creative @a[x=10,y=20,z=30,r=4]
/gamemode creative @a[10,20,30,4]
Selecting targets by coordinate
[x=X,y=Y,z=Z] — Selects targets based on distance to that exact position. Combine with selecting by radius to select only targets at that specific position.
The coordinates have to be exact - tilde notation is not available for selector argument coordinates.
Selecting targets by radius
[r=R] — Selects only targets less than R blocks from the command's execution.
[rm=RM] — Selects only targets more than RM blocks from the command's execution.
If a coordinate (above) and either or both radius/i are both defined, the radius/i will center on the coordinate rather than the postion of the command's execution. By using a very distant coordinate and a very large radius, it is possible to simulate a near-linear edge to use to specify targets.
Selecting targets by game mode
[m=M] — Selects only targets with the specified game mode. Permitted value for M are:
  • -1: all game modes
  • 0: survival mode
  • 1: creative mode
  • 2: adventure mode
  • 3: spectator mode
Selecting targets by count
[c=C] — Selects only the specified number of targets. Usually in order of distance from the command executor.
When used with @p or @r, this argument defaults to 1, so using a higher number will increase the number of nearest or random targets returned. When used with @a or @e, this argument returns only the nearest targets.
If there are multiple nearest players, caused by them being precisely the same distance away, a player is selected by the time the player most recently joined the server. For example, if equally distant, @a[c=1] will select the player who has been on the server the longest and @e[type=Creeper,c=3] will select the three oldest creepers.
When used with a negative value, the order of targets is reversed. For example, @p[c=-3] will return the three farthest targets, and, if all potential targets are equally far away, @e[c=-3] will select the last three targets created.
Selecting targets by experience level
[l=L] — Selects only targets with no more than L experience levels.
[lm=LM] – Selects only targets with no less than LM experience levels.
Selecting targets by score
[score_name=SCORE] — Selects only targets with a score in objective name of no more than SCORE.
[score_name_min=SCOREMIN] — Selects only targets with a score in objective name of no less than SCOREMIN.
For example, @a[score_points_min=30,score_points=39] will select all players with a score in objective "points" between 30 and 39 (inclusive).
See also: Scoreboard#Objectives
Selecting targets by team
[team=TEAM] — Selects only targets on team TEAM.
[team=!TEAM] — Selects only targets not on team TEAM.
[team=] — Selects only targets not on any team.
See also: Scoreboard#Teams
Selecting targets by name
[name=NAME] — Selects only targets named NAME.
[name=!NAME] — Selects only targets not named NAME.
Selecting targets by volume
[dx=DX,dy=DY,dz=DZ]
Selects only targets within the volume defined as starting from the location where the command was executed and extending DX blocks in the positive "x" direction (i.e., east), DY blocks in the positive "y" direction (i.e., upwards), and DZ blocks in the positive "z" direction (i.e., south). All values must be positive. If an initial coordinate is specified with the x, y, and z arguments, that will be used instead of the position of the command's execution for the lower northwestern corner (dx, dy, and dz still specify distances from that coordinate; they do not specify a separate coordinate).
It is possible to combine selection by radius and selection by volume, in which case the command will only select targets within the overlap of both regions (within certain radius/i of the volume's lower northwest corner and not outside the defined volume).
Selecting targets by vertical rotation
[rx=RX] — Selects only targets with a maximum vertical rotation of RX.
[rxm=RXM] — Selects only targets with a minimum vertical rotation of RXM.
Vertical rotation values vary from -90.0 facing straight up to 90.0 facing straight down (thus vertical rotation values increase with rotation downwards).
Selecting targets by horizontal rotation
[ry=RY] — Selects only targets with a maximum horizontal rotation of RY.
[rym=RYM] — Selects only targets with a minimum horizontal rotation of RYM.
Horizontal rotation values vary from -180.0 (facing due north), to -90.0 (facing due east), to 0.0 (facing due south), to 90.0 (facing due west), to 179.9 (just west of due north) before wrapping back to -180.0 (thus horizontal rotation values increase with rotation to the right, or clockwise viewed from above).
Selecting targets by type
[type=TYPE] — Selects only targets of the specific entity type.
[type=!TYPE] — Selects only targets not of the specific entity type.
TYPE must be an entity ID used to identify different types of entities internally (for example, Creeper for creepers, MinecartRideable for regular minecarts, PrimedTnt for primed TNT, etc.). Entity IDs are case-sensitive and invalid entity IDs will cause the command to fail.
When used with @r, can change its normal behavior of targeting only players to target other entities.


Data tags[edit]

A data tag is a sequence of text which describes a data structure using attribute-value pairs. Data tags are used in commands to specify complex data for players, entities, and some blocks.

A data tag consists of zero or more attribute-value pairs separated by commas and delineated by curly brackets. Each attribute-value pair consists of an attribute name and the attribute's value, separated by a colon. Some values, however, may themselves contain attribute-value pairs, allowing a data tag to describe a hierarchical data structure.

Example: {name1:123,name2:"sometext",name3:{subname1:456,subname2:789}}

The data structures that data tags describe are the same ones used in Minecraft's save files. These data structures are described in other articles and commands expect data tags to use the same attribute names (which are case-sensitive):

Data Structure Specification Links
Objects Examples
Tile entities chests, furnaces, command blocks, mob spawners, signs, etc.
Items items in inventories (includes specifications for enchantments, lore, custom names, etc.)
Item entities items on the ground
Mobs creepers, cows, villagers, etc.
Projectiles arrows, fireballs, thrown potions, etc.
Vehicles boats, minecarts, etc.
Dynamic tiles primed TNT, falling sand/gravel
Other entities firework rockets, paintings, and item frames

The defined data structures also expect the values to be of the correct type.

Data Tags Value Types
Type Description

 Byte
An integer between -128 and 127 (inclusive).

 Short
An integer between -32,768 and 32,767 (inclusive).

 Int
An integer between -2,147,483,648 and 2,147,483,647 (inclusive).

 Long
An integer between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807 (inclusive).

 Float

 Double
Numbers which can have a decimal portion (for example, 3.14159).

 String
A sequence of text, optionally delineated with double quotes.

Double quotes must be used if the String contains commas, curly brackets, or square brackets. To include a double quote inside a String, add a backslash before the double quote.

Example: "Call me \"Ishmael\""

 List
A sequence of values, separated by commas and delineated with square brackets. The values do not necessarily need to be all the same type -- the types required are specified by the data structure.
Example: [3.2,64,129.5]

 Byte Array
A sequence of integers between -128 and 127 (inclusive), separated by commas and delineated with square brackets.

 Int Array
A sequence of integers between -2,147,483,648 and 2,147,483,647 (inclusive), separated by commas and delineated with square brackets.

 Compound
A sequence of attribute-value pairs, separated by commas and delineated with curly brackets.
Example: {X:3,Y:64,Z:129}

Every data tag argument is itself a Compound.

Some commands may require that a number's type be specified by adding a character to the end of the value. For example, 3i for an int, 3.2f for a float, etc.

When commands such as /testfor, /testforblock, and /clear are used to match data tags, they only check for the presence of the provided tags in the target entity/block/item. This means that the entity/block/item may have additional tags and will still match. This is true even for lists and arrays: the order of a list is not acknowledged, and as long as every requested element is in the list, it will match even if there are additional elements.

The format used for data tags is a lenient form of JSON.

Raw JSON text[edit]

The /tellraw and /title commands use a specific lenient JSON format to specify complicated text. Similar to the NBT format notation above, concepts such as Strings, Objects (Compounds), and Lists are used to represent the various properties of the raw text.

The format of raw JSON text is a JSON Object which supports the following (mostly optional) elements:


  • The base chat component Object

    •  text: A string representing raw text to display directly in chat. Note that selectors such as "@a" and "@p" are not translated into player names; use selector instead. "\n" is newline (enter).

    •  extra: A list of additional objects, sharing the same format as the base object.

      • A list element with the same format as the base object (recursive). Note that all properties of this object are inherited by children except for text, extra, translate, with, and score. This means that children will retain the same formatting and events as this object unless they explicitly override them.

    •  color: The color to render this text in. Valid values are "black", "dark_blue", "dark_green", "dark_aqua", "dark_red", "dark_purple", "gold", "gray", "dark_gray", "blue", "green", "aqua", "red", "light_purple", "yellow", "white", and "reset" (cancels out the effects of colors used by parent objects). Technically, "bold", "underline", "italic", "strikethrough", and "obfuscated" are also accepted, but it may be better practice to use the tags below for such formats.

    •  bold: Boolean (true/false) - whether to render text in bold. Defaults to false.

    •  underlined: Boolean (true/false) - whether to render text underlined. Defaults to false.

    •  italic: Boolean (true/false) - whether to render text in italics. Defaults to false.

    •  strikethrough: Boolean (true/false) - whether to render text with a strikethrough. Defaults to false.

    •  obfuscated: Boolean (true/false) - whether to render text obfuscated. Defaults to false.

    •  insertion: When the text is shift-clicked by a player, this string will be inserted in their chat input. It will not overwrite any existing text the player was writing.

    •  clickEvent: Allows for events to occur when the player clicks on text.

      •  action: The action to perform when clicked. Valid values are "open_url" (opens value as a URL in the player's default web browser), "run_command" (has value entered in chat as though the player typed it themselves. This can be used to run commands, but the command will fail if the player does not have the required permissions to use it), "change_page" (can only be used in written books, changes to page value if that page exists), and "suggest_command" (similar to "run_command", but the text only appears in the player's chat input, and is not automatically entered. Unlike insertion, this will replace the existing contents of the chat input).

      •  value: The URL, chat, or command used by the specified action. Note that commands must be prefixed with the usual "/" slash.

    •  hoverEvent: Allows for a tooltip to be displayed when the player hovers their mouse over text.

      •  action: The type of tooltip to show. Valid values are "show_text" (shows raw JSON text), "show_item" (shows the tooltip of an item which can have NBT tags), "show_achievement" (shows formatted text describing an achievement or statistic. Normal achievement names are green, final achievement names are dark_purple, and statistic names are gray. In addition, a description is given for achievements), and "show_entity" (shows an entity's name, possibly its type, and its UUID).

      •  value: The formatting of this tag varies depending on the action. Note that "show_text" is the only action to support an Object as the value; all other action values are Strings and should thus be wrapped in quotes.
        • "show_text": Can be either a raw String of text, or an Object with the same formatting as this base object. Note that clickEvent and hoverEvent do not function within the tooltip, but the formatting and extra tags still work.
        • "show_item": A string formatted like item NBT data. Contains the "id" tag, and optionally the "Damage" tag and "tag" tag (which is the same compound used as "dataTag" in the /give command).
        • "show_achievement": The achievement or statistic's name. This uses the same format as achievement and statistic Scoreboard objective criteria and the /achievement command.
        • "show_entity": A string formatted like a compound with the string values "type" (such as "Zombie"), "name", and "id" (should be an entity UUID, but can actually be any string).

    •  translate: The translation identifier of text to be displayed using the player's selected language. This identifier is the same as the identifiers found in lang files from assets or resource packs. The translated text will only be displayed if the text string is not used.

    •  with: A list of chat component arguments and/or string arguments to be used by translate.
      • The arguments are text corresponding to the arguments used by the translation string in the current language, in order (for example, the first list element corresponds to "%1$s" in a translation string).

    •  score: A compound for displaying a player's score in an objective. Displays nothing if the player is not tracked in the given objective. Ignored completely if text or translate is present.

      •  name: The name of the player whose score should be displayed. Selectors (such as @p) can be used, in addition to "fake" player names created by the scoreboard system. In addition, if the name is "*", it will show the player's own score (for example, /tellraw @a {score:{name:"*",objective:"obj"}} will show every online player their own score in the "obj" objective). Note that non-player entity scores (such as @e[type=Cow]) do not show, even if the entity has been given a score in the objective.

      •  objective: The internal name of the objective to display the player's score in.

      •  value: Optional. If present, this value is used regardless of what the score would have been.

    •  selector: A string containing a selector (@p,@a,@r, or @e) and, optionally, selector arguments. Unlike text, the selector will be translated into the correct player/entity names. If more than one player/entity is detected by the selector, it will be displayed in a form such as 'Name1 and Name2' or 'Name1, Name2, Name3, and Name4'. Ignored completely if text, translate, or score is present.

Due to the extra tag, the above format may be recursively nested to produce very complex and functional text strings. However, a raw json text doesn't have to be complicated at all: virtually all properties are optional and may be left out.

To be valid, each object must have at least either text, translate, or score (everything else is optional). As a matter of shorthand, however, the entire Object may be substituted with a String. In this case, that string will be considered the value of the text property. For example, "This is raw text" is equivalent to {text:"This is raw text"}. This shorthand substitution is valid anywhere a raw text object is required (including the base <raw json message> argument of /tellraw, the elements of the extra list, and the value of a "show_text" hover_event).

Finally, unlike other commands using JSON, /tellraw Strings support Unicode via the notation \u####, where #### is the Unicode hexadecimal number for the desired character.

External links
Skylinerw's JSON Formatting Examples
Tellraw Generator

Summary of commands[edit]

The table below summarizes available commands. Click a column heading to sort by that column.

Summary of Commands
Command Description Op Only MP Only Blocks Entities Players World
/achievement Gives a player an achievement. Op Players
/ban Adds player to banlist. Op MP Players
/ban-ip Adds IP address to banlist. Op MP Players
/banlist Displays banlist. Op MP Players
/blockdata Modifies the data tag of a block. Op Blocks
/clear Clears items from player inventory. Op Players
/clone Copies blocks from one place to another. Op Blocks
/debug Starts or stops a debugging session. Op
/defaultgamemode Sets the default game mode. Op World
/deop Revoke operator status from a player. Op MP Players
/difficulty Sets the difficulty level. Op Players
/effect Add or remove status effects. Op Entities Players
/enchant Enchants a player item. Op Players
/entitydata Modifies the data tag of an entity. Op Entities
/execute Executes another command. Op
/fill Fills a region with a specific block. Op Blocks
/gamemode Sets a player's game mode. Op Players
/gamerule Sets or queries a game rule value. Op World
/give Gives an item to a player. Op Players
/help Provides help for commands.
/kick Kicks a player off a server. Op MP Players
/kill Kills entities (players, mobs, items, etc.). Op Entities Players
/list Lists players on the server. Op MP Players
/me Displays a message about yourself. Players
/op Grants operator status to a player. Op MP Players
/pardon Removes entries from the banlist. Op MP Players
/particle Creates particles. Op Players
/playsound Plays a sound. Op Players
/publish Opens single-player world to local network. Op World
/replaceitem Replaces items in inventories. Op Blocks Entities Players
/save-all Saves the server to disk. Op MP World
/save-off Disables automatic server saves. Op MP World
/save-on Enables automatic server saves. Op MP World
/say Displays a message to multiple players. Players
/scoreboard Manages objectives, players, and teams. Op Entities Players
/seed Displays the world seed. Op World
/setblock Changes a block to another block. Op Blocks
/setidletimeout Sets the time before idle players are kicked. Op MP Players
/setworldspawn Sets the world spawn. Op World
/spawnpoint Sets the spawn point for a player. Op Players
/spreadplayers Teleports entities to random locations. Op Entities Players
/stats Update objectives from command results. Op Blocks Entities Players
/stop Stops a server. Op MP World
/summon Summons an entity. Op Entities
/tell Displays a private message to other players. Players
/tellraw Displays a JSON message to players. Op Players
/testfor Counts entities matching specified conditions. Op Entities Players
/testforblock Tests whether a block is in a location. Op Blocks
/testforblocks Tests whether the blocks in two regions match. Op Blocks
/time Changes or queries the world's game time. Op World
/title Manages screen titles. Op Players
/toggledownfall Toggles the weather. Op World
/tp Teleports entities. Op Entities Players
/trigger Sets a trigger to be activated. Op Players
/weather Sets the weather. Op World
/whitelist Manages server whitelist. Op MP Players
/worldborder Manages the world border. Op World
/xp Adds or removes player experience. Op Players

List of commands[edit]

Syntax
If you see… Then
plain text Enter this literally, exactly as shown.
italics Replace this with an appropriate value.
<angle brackets> This is a required argument.
[square brackets] This is an optional argument.
x|y

Pick one of the options shown.

Available options are shown separated by vertical bars: |

ellipsis … The argument may consist of multiple words separated by spaces.
Success Conditions
A command's Success Conditions must be met in order for the game to consider the command "successful". This is used to determine a variety of things, such as the output of a redstone comparator feeding from command block with a command. Note that not all "successful" commands actually do something, and not all "failed" commands fail to do something useful.
Restrictions
Describes restrictions on who can use the command or in what context.
  • None: The command can be used by any player in any world. The following commands have no restrictions: /help, /me, /tell, and /trigger.
  • Operator: The command may only be used by an operator or in singleplayer mode with cheats enabled. On multiplayer servers, the results of these commands are broadcast to other ops online.
No multiplayer commands permit target selectors in arguments and, except for /list, multiplayer commands cannot be used in command blocks. Many of these commands can be used on players who have never been to the server, or even on names which are not (or cannot be) registered as Minecraft accounts.
  • No command blocks: The command cannot be executed by a command block.


achievement[edit]

achievement
Restrictions

Operator

First introduced

1.7.2 (13w36a)

Gives a player an achievement or increases a statistic.

Syntax
achievement <give|take> <stat_name|*> [player]
Arguments
stat_name
Must be either:
  • achievement.achievement_name, where achievement_name is a valid achievement identifier
  • stat.statistic_name, where statistic_name is a valid statistic identifier
  • * to represent all achievements
player (optional)
Must be a player name or a target selector. If not specified, defaults to the command's executor. Not optional in command blocks.
Result
Fails if arguments aren't specified properly, or if player fails to resolve to one or more online players.
On success, grants or removes the specified achievement(s) (and all prerequisite achievements) to the player(s) or increases/decreases the specified statistic of the player(s) by 1.
Examples
To grant the "Overkill" achievement to yourself: achievement give achievement.overkill
To grant the "Taking Inventory" achievement to Alice: achievement give achievement.openInventory Alice
To increase the "Mob Kills" statistic by 1 for the nearest player: achievement give stat.mobKills @p
To remove all achievements from all players: achievement take * @a
See also
Commands to modify player:


ban[edit]

These commands manage a server banlist. The server banlist is a list of players or IP addresses that will not be allowed to connect to the server. Bans supersede any whitelisting in place.

See also: /whitelist


ban[edit]

ban
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Alpha 1.0.16

Adds player to banlist.

Syntax
ban <name> [reason …]
Arguments
name
The name of the player to be banned. Does not need to be online, or even real.
reason (optional)
Text to be displayed with the ban, to other operators and in the server logs.
Result
Always succeeds. The player name is added to the server banlist which prevents anyone from connecting to the server by that name.


ban-ip[edit]

ban-ip
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Alpha 1.0.16

Adds IP address to banlist.

Syntax
ban-ip <address|name> [reason …]
Arguments
address|name
Must be a player name or an IP address.
reason (optional)
Text to be displayed with the ban, to other operators and in the server logs.
Result
Fails if address|name is neither a valid IP address nor the name of an online player.
On success, the IP address (of the online player, or the address specified) is added to the server banlist which prevents anyone from connecting to the server from that address.


banlist[edit]

banlist
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Alpha 1.0.16

Displays banlist.

Syntax
banlist ips
banlist players
Result
Always succeeds. Displays banned IP addresses or banned players.


blockdata[edit]

blockdata
Restrictions

Operator

First introduced

1.8 (14w02a)

Modifies the data tag of a block.

Syntax
blockdata <x> <y> <z> <dataTag>
Arguments
x y z
Specifies the coordinates of the block to be modified. May be provided in tilde notation to identify a position relative to the command's execution.
dataTag
Specifies the data tag elements to be added to, or overwrite elements of, the specified block. Must be a compound NBT tag (for example, {CustomName:Fred}).
Result
Fails if arguments are not specified properly.
On success, modifies the data tag of the targeted block.
Examples
To change the primary power of the beacon at (0,64,0) to Haste:
blockdata 0 64 0 {Primary:3}
See also


clear[edit]

clear
Restrictions

Operator

First introduced

1.4.2 (12w37a)

Clears items from player inventory.

Syntax
clear [player] [item] [data] [maxCount] [dataTag]
Arguments
player (optional)
Must be a player name or a target selector. If not specified, defaults to the command's user. Not optional in command blocks.
item data (optional)
Specifies the id and data of the item to be cleared. If neither argument is specified, clears all items from the inventory. If item is specified, but not data, all items with id item are cleared, regardless of their data. data can be set to -1 to ignore data and clear all blocks of a certain id when maxCount or dataTag must be specified but data needs to be ignored.
maxCount (optional)
Specifies the maximum number of items to be cleared. If not specified, or if -1, clears all items. If 0, does not clear items, but returns successfully if there were items that could have been cleared (allowing detection of items rather than clearing of items).
dataTag (optional)
Specifies the data tags of the item to be cleared (only items matching the specified data tags will be cleared — data tags not specified will not be considered). Must be a compound NBT tag (for example, {display:{Name:Fred}}).
Result
Fails if the arguments are not specified properly, if player fails to resolve to one or more online players, or if no items are removed.
On success, removes the specified items from the player(s).
Examples
To clear your entire inventory: clear
To clear all items from Alice's inventory: clear Alice
To clear all wool items from Alice's inventory: clear Alice minecraft:wool
To clear all orange wool items from the inventory of all players: clear @a minecraft:wool 1
To clear all golden swords with the "Sharpness I" enchantment from the nearest player, regardless of their damage value:
clear @p minecraft:golden_sword -1 -1 {ench:[{id:16s,lvl:1s}]}
See also
/give — give items to player


clone[edit]

clone
Restrictions

Operator

First introduced

1.8 (14w03a)

Clones blocks from one region to another.

Syntax
clone <x1> <y1> <z1> <x2> <y2> <z2> <x> <y> <z> [maskMode] [cloneMode] [TileName]
The in-game help for the clone command does not list the final argument. TileName is a placeholder name for the purpose of discussion.
Arguments
x1 y1 z1 and x2 y2 z2
Specifies any two opposing corner blocks of the region to be cloned (the "source region"). May use tilde notation to specify distances relative to the command's execution.
The blocks that make up the corners extend in the positive direction from the coordinates used to identify them. Because of this, the lesser coordinates of each axis will be right on the region boundary, but the greater coordinates will be one block from the boundary, and the block volume of the source region will be (xgreater - xlesser + 1) × (ygreater - ylesser + 1) × (zgreater - zlesser + 1). For example, 0 0 0 0 0 0 has a 1-block volume, and 0 0 0 1 1 1 and 1 1 1 0 0 0 both identify the same region with an 8-block volume.
x y z
Specifies the lower northwest corner (i.e., the smallest coordinates of each axis) of the region to clone to (the "destination region"). May use tilde notation to specify a distance relative to the command's execution.
maskMode (optional)
Must be one of:
  • filtered — Clone only blocks with the specified block id (see TileName below).
  • masked — Copy only non-air blocks. Blocks in the destination region that would otherwise be overwritten by air are left unmodified.
  • replace — Copy all blocks, overwriting all blocks of the destination region with the blocks from the source region.
If not specified, defaults to replace.
cloneMode (optional)
Must be one of:
  • force — Force the clone even if the source and destination regions overlap.
  • move — Clone the source region to the destination region, then replace the copied blocks with air. When used in filtered mask mode, only the cloned blocks will be replaced with air.
  • normal — Don't move or force. Used when TileName also needs to be specified.
If not specified, defaults to normal.
TileName (optional)
Specifies the block id (for example, minecraft:stone) to copy when using filtered mask mode. Not optional when using filtered mask mode.
Result
Fails if the arguments are not specified correctly, if the block volume of the source region is greater than 32768 (enough for the equivalent of eight chunk sections), if the source and destination region overlap (unless using force clone mode), or if one or both regions isn't currently rendered.
On success, overwrites blocks in the destination region with blocks from the source region, leaving the source region unmodified (unless using move clone mode).
See also
/fill — fill a region with a block


debug[edit]

debug
Restrictions

Operator
No command blocks

First introduced

1.3.1 (12w27a)

Starts or stops a debugging session.

Syntax
debug <start|stop>
Arguments
start
Starts a new debug profiling session.
stop
Stops the active debug profiling session.
Result
Fails if tried to start a debug session when one is already active, or if tried to stop a debug session when none is running.
On success, starts or stops the debug session. While active, includes notifications about potential performance bottlenecks in the console. When stopped, creates a profiler results file in the folder "debug".


defaultgamemode[edit]

defaultgamemode
Restrictions

Operator

First introduced

1.3.1 (12w22a)

Sets the default game mode (creative, survival, etc.) for new players entering a multiplayer server.

Syntax
defaultgamemode <mode>
Arguments
mode
Must be one of:
  • survival (can be abbreviated as s or 0) for survival mode
  • creative (can be abbreviated as c or 1) for creative mode
  • adventure (can be abbreviated as a or 2) for adventure mode
  • spectator (can be abbreviated as sp or 3) for spectator mode
"hardcore" is not a valid option for the mode argument, as it is technically not a game mode.
Result
Fails if arguments aren't specified properly.
If successful, sets the default game mode that is shown on the world selection menu. New players that join the world will be put into the default game mode.
Examples
To set the default game mode to survival: defaultgamemode survival, defaultgamemode s, or defaultgamemode 0
See also
/gamemode – changes a player's game mode


deop[edit]

deop
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Alpha 1.0.16

Revoke operator status from a player.

Syntax
deop <player>
Arguments
player
Specifies a player to remove from the list of operators. May be anything but target selectors will not evaluate and only actual player names will produce a useful result.
Result
Always succeeds if restrictions are satisfied. If player matches a name on the list of operators, the name is removed from the list and any player by that name no longer has operator status.
Examples
To remove Alice from the list of operators: deop Alice


difficulty[edit]

difficulty
Restrictions

Operator

First introduced

1.4.2 (12w32a)

Sets the difficulty level (peaceful, easy, etc.).

Syntax
difficulty <new difficulty>
Arguments
new difficulty
Must be one of:
  • peaceful (can be abbreviated as p or 0) for peaceful difficulty
  • easy (can be abbreviated as e or 1) for easy difficulty
  • normal (can be abbreviated as n or 2) for normal difficulty
  • hard (can be abbreviated as h or 3) for hard difficulty
"hardcore" is not a valid option for the new difficulty argument, as it is not a difficulty.
Result
Fails if arguments aren't specified properly.
If successful, changes the game's difficulty. On a multiplayer server lasts only until the server is restarted — on restart, difficulty is reloaded from server.properties.
Examples
To change the difficulty to hard: difficulty hard, difficulty h, or difficulty 3
See also
/gamemode – changes a player's game mode (creative, survival, etc.)


effect[edit]

effect
Restrictions

Operator

First introduced

1.5 (13w09b)

The effect command manages status effects on players and other entities.

Syntax
effect <player> clear (removes all effects)
effect <player> <effect> [seconds] [amplifier] [hideParticles] (gives an effect)
Arguments
player
Specifies the target(s). Must be a player name or a target selector (@e is permitted to target entities other than players).
effect
Specifies the effect to grant. Must be a status effect id (for example, 1 or minecraft:speed).
seconds (optional)
Specifies the effect's duration in seconds. Must be between 0 and 1,000,000 (inclusive). If not specified, defaults to 30 seconds.
amplifier (optional)
Specifies the number of additional levels to add to the effect. Must be between 0 and 255 (inclusive). If not specified, defaults to 0.
hideParticles (optional)
Specifies whether the particles of the status effect should be hidden. Must be either true or false. If not specified, defaults to false.
Result
Fails if arguments are not specified correctly, if player fails to resolve to one or more valid entities (named players must be online), if seconds was specified as 0 and the target did not have the effect, or if no effects were removed in clear mode.
On success:
  • clear — clears all status effects from the target(s).
  • effect — Adds the status effect to the target(s). If a target already has the status effect, a new status effect with the same amplifier will only override the old duration if it is longer, but a new status effect with a higher duration will override any previous duration. If seconds is set to 0, cancels the specified effect instead.
Examples
To grant a Speed 1 effect to the nearest player for 60 seconds: effect @p 1 60
To grant a Speed 3 effect to the nearest player for 60 seconds: effect @p 1 60 2
To clear any Haste effects from all players: effect @a 3 0
To clear all effects from all zombies: effect @e[type=Zombie] clear


enchant[edit]

enchant
Restrictions

Operator

First introduced

1.4.4 (1.4.4-pre)

Adds an enchantment to a player's targeted item.

Syntax
enchant <player> <enchantment ID> [level]
Arguments
player
Specifies the target(s). Must be a player name or target selector.
enchantment ID
Specifies the enchantment to be added to the item held by the target. Must be a valid enchantment ID (for example, 16 or minecraft:sharpness).
level (optional)
Specifies the enchantment level. Must be at least 1 and not greater than the maximum level for the specified enchantment. If not specified, defaults to 1.
Result
Fails if arguments are not specified correctly, if player fails to resolve to one or more online players, or if the enchantment is not valid for the item or conflicts with current enchantments (for example, "Fire Protection" cannot be given to armor which already has "Protection", and "Sharpness III" cannot be given to a sword which already has "Sharpness I").
On success, adds the specified enchantment to the item held by the target.
Examples
To give the Infinity enchantment to all players holding a bow: enchant @a 51


entitydata[edit]

entitydata
Restrictions

Operator

First introduced

1.8 (14w32b)

Modifies the data tag of an entity.

Syntax
entitydata <entity> <dataTag>
Arguments
entity
Specifies the entity(ies) to be modified. Must be an entity UUID or the @e target selector.
dataTag
Specifies the data tag elements to be added to, or overwrite elements of, the specified entity. Must be a compound NBT tag (for example, {CustomName:Fred}).
Result
Fails if arguments are not specified properly, or if entity fails to resolve to one or more non-player entities (players can not be changed).
On success, modifies the data tag of the targeted entity(ies).
Examples
To prevent all current zombies from picking up loot:
entitydata @e[type=Zombie] {CanPickUpLoot:0}


execute[edit]

execute
Restrictions

Operator

First introduced

1.8 (14w07a)

Executes a command with a different user and position.

Syntax
execute <entity> <x> <y> <z> <command …>
An alternate syntax allows the command to be executed only if a specific block is detected:
execute <entity> <x> <y> <z> detect <x2> <y2> <z2> <block> <data> <command …>
Arguments
entity
Specifies the target to be the command's executor. Must be a player name or target selector.
x y z
Specifies the position from which to run the command. x and z must be within the range -30,000,000 to 30,000,000 (inclusive). May use tilde notation to specify distances relative to the target.
command
Specifies the command to be run. Must be a valid command.
x2 y2 z2 (detect mode only)
Specifies the position of the block to check. x2 and z2 must be within the range -30,000,000 to 30,000,000 (inclusive). May use tilde notation to specify distances relative to (x,y,z).
block and data (detect mode only)
Specifies the block id and data which the block at (x2,y2,z2) must match for the command to run. block must be a valid block id (for example, minecraft:stone), and data must be a valid block data for that type of block or -1 to match any block data.
Result
Fails if arguments are not specified properly, if entity fails to resolve to one or more valid entities (named players must be online), if the checked block is not of the correct block id and data, or if the specified command fails.
On success, executes the specified command as if executed by the specified target(s) with operator-level permission at the specified coordinate.
Examples
To summon lightning bolts at the positions of every zombie:
execute @e[type=Zombie] ~ ~ ~ summon LightningBolt
To summon lightning bolts at the positions of every zombie standing on any type of sand:
execute @e[type=Zombie] ~ ~ ~ detect ~ ~-1 ~ minecraft:sand -1 summon LightningBolt
See also
/testforblock — tests for a certain block at a specified position (including specific data tags)


fill[edit]

fill
Restrictions

Operator

First introduced

1.8 (14w03a)

Fills all or parts of a region with a specific block.

Syntax
fill <x1> <y1> <z1> <x2> <y2> <z2> <TileName> [dataValue] [oldBlockHandling] [dataTag]
The fill command also has an optional alternate syntax when using the replace option:
fill <x1> <y1> <z1> <x2> <y2> <z2> <TileName> <dataValue> replace [replaceTileName] [replaceDataValue]
Arguments
x1 y1 z1 and x2 y2 z2
Specifies any two opposing corner blocks of the region to be filled (the "fill region"). May use tilde notation to specify distances relative to the command's execution.
The blocks that make up the corners extend in the positive direction from the coordinates used to identify them. Because of this, the lesser coordinates of each axis will be right on the region boundary, but the greater coordinates will be one block from the boundary, and the block volume of the source region will be (xgreater - xlesser + 1) × (ygreater - ylesser + 1) × (zgreater - zlesser + 1). For example, 0 0 0 0 0 0 has a 1-block volume, and 0 0 0 1 1 1 and 1 1 1 0 0 0 both identify the same region with an 8-block volume.
TileName
Specifies the block to fill the region with. Must be a block id (for example, minecraft:stone).
dataValue (optional)
Specifies the block data to use for the fill block. Must be between 0 and 15 (inclusive).
oldBlockHandling (optional)
Must be one of:
  • destroy - Replaces all blocks (including air) in the fill region with the specified block, dropping the replaced blocks and block contents as entities as if they had been mined.
  • hollow - Replaces only blocks on the outer edge of the fill region with the specified block. Inner blocks are changed to air, dropping their contents as entities but not themselves.
  • keep - Replaces only air blocks in the fill region with the specified block.
  • outline - Replaces only blocks on the outer edge of the fill region with the specified block. Inner blocks are not affected.
  • replace - Replaces all blocks (including air) in the fill region with the specified block, without dropping blocks or block contents as entities. Optionally, instead of specifying a data tag for the replacing block, block id and data values may be specified to limit which blocks are replaced (see replaceTileName and replaceDataValue below)
If not specified, defaults to replace.
dataTag (optional)
Specifies the data tag to use for the fill block (for example, contents of a chest, patterns on a banner, etc.). Must be a compound NBT tag (for example, {CustomName:Fred}). Cannot be combined with the replaceTileName and replaceDataValue arguments.
replaceTileName replaceDataValue (optional)
Arguments are only valid when oldBlockHandling is replace. Cannot be combined with the dataTag argument.
Specifies the block id and data of the blocks in the fill region to be replaced. If replaceDataValue is not specified, data value is ignored when determining which blocks to replace. If both arguments are not specified, replaces all blocks in the fill region.
Result
Fails if arguments are not specified properly, if the fill region is not rendered, if the block volume of the fill region is greater than 32768, if dataValue or dataTag are invalid for the specified block id, or if no blocks were changed.
On success, changes blocks in the fill region to the specified block.


gamemode[edit]

gamemode
Restrictions

Operator

First introduced

1.3.1 (12w16a)

Sets a player's game mode.

Syntax
gamemode <mode> [player]
Arguments
mode
Must be one of:
  • survival (can be abbreviated as s or 0) for survival mode
  • creative (can be abbreviated as c or 1) for creative mode
  • adventure (can be abbreviated as a or 2) for adventure mode
  • spectator (can be abbreviated as sp or 3) for spectator mode
"hardcore" is not a valid option for the mode argument, as it is technically not a game mode.
player (optional)
If specified, must be either a player's username or a target selector. If unspecified, defaults to the player using the command. When used in a command block, player is not optional.
Result
Fails if arguments aren't specified properly, or if player fails to resolve to one or more online players.
If successful, changes the game mode of the default or specified players.
Examples
To put yourself into creative mode: gamemode creative, gamemode c, or gamemode 1
To put all players into survival mode: gamemode 0 @a
See also
defaultgamemode – sets the initial game mode for players joining the world


gamerule[edit]

gamerule
Restrictions

Operator

First introduced

1.4.2 (12w32a)

Sets or queries a game rule value.

Syntax
gamerule <rule name> [value]
Arguments
rule name
Specifies the game rule to set or query. May be any value, but only certain predefined game rules will affect gameplay (see Predefined Game Rules below).
value (optional)
Specifies the value to set the game rule to. May be any value, though only true or false specified for predefined game rules will actually affect gameplay, except in the case of randomTickSpeed, where any number 0 or higher will affect gameplay (see Predefined Game Rules below).
Predefined Game Rules
Rule Name Description Default Value
commandBlockOutput Whether command blocks should notify admins when they perform commands true
doDaylightCycle Whether time progresses true
doFireTick Whether fire should spread and naturally extinguish true
doMobLoot Whether mobs should drop items true
doMobSpawning Whether mobs should naturally spawn true
doTileDrops Whether blocks should have drops true
keepInventory Whether the player should keep items in their inventory after death false
logAdminCommands Whether to log admin commands to server log true
mobGriefing Whether creepers, zombies, endermen, ghasts, withers, rabbits, sheep, and villagers should be able to change blocks and whether villagers, zombies, skeletons, and zombie pigmen can pick up items true
naturalRegeneration Whether the player can regenerate health naturally if their hunger is full enough (doesn't affect external healing, such as golden apples, the Regeneration effect, etc.) true
randomTickSpeed How often a random block tick occurs (such as plant growth, leaf decay, etc.) per chunk section per game tick. 0 will disable random ticks, higher numbers will increase random ticks 3
reducedDebugInfo Whether the debug screen shows all or reduced infomation false
sendCommandFeedback Whether the feedback from commands executed by a player should show up in chat true
showDeathMessages Whether a message appears in chat when a player dies true
Upcoming in 1.8.1
doEntityDrops Whether entities that are not mobs should have drops true
Result
Fails if rule name is not defined and value is not provided (i.e., attempting to query an undefined game rule).
On success, returns the value of the game rule (if value is not provided) or sets the game rule to the specified value (if value is provided).
New game rules may be defined and set (by providing a value) or queried (by not providing a value).
Examples
To stop the day-night cycle: gamerule doDaylightCycle false
To stop natural healing: gamerule naturalRegeneration false
To define a new game rule called MyNewRule and sets its value to 10: gamerule MyNewRule 10


give[edit]

give
Restrictions

Operator

First introduced

1.3.1 (12w16a)

Gives an item to a player.

Syntax
give <player> <item> [amount] [data] [dataTag]
Arguments
player
Specifies the target to give item(s) to. Must be a player name or target selector.
item
Specifies the item to give. Must be a valid item id (for example, 256 or minecraft:iron_shovel), or block id for which items exist.
amount (optional)
Specifies the number of items to give. Must be between 1 and 64 (inclusive). If not specified, defaults to 1.
data (optional)
Specifies the item data of the given item(s). Must be an integer between -2,147,483,648 and 2,147,483,647 (inclusive, without the commas), but values which are invalid for the specified item id default to 0. If not specified, defaults to 0.
dataTag (optional)
Specifies the data tag of the given item(s). Must be a compound NBT tag (for example, {display:{Name:Fred}}).
Result
Fails if arguments are not specified properly, or if player fails to resolve to one or more online players.
On success, summons the specified item(s) at the location(s) of the target(s). If player resolves to multiple targets, each receives the specifed number of items. The item entity's Owner tag is set to the target and its PickupDelay tag set to 0[Verify] so the item can be picked up immediately and only by the target (if the target has room in their inventory).
Examples
To summon 30 blocks of spruce wood planks at John's location with Lore that says "Wooden planks":
give John minecraft:planks 30 1 {display:{Lore:["Wooden planks"]}}
See also
/summon — summon any entity at any location


help[edit]

help
Restrictions

None

First introduced

1.3.1 (12w17a)

Provides help for commands.

Syntax
help [page|command name]
? [page|command name]
Arguments
page|command name (optional)
Specifies the page number of the command list or the command to provide help for. If not specified, defaults to 1 (the first page of the command list).
Result
Fails if page is not a valid page number, or if command name is not a valid command name. Technically fails even if a valid command name is specified, although it displays the usage of the command.
On success, displays a page of the command list. Multiplayer commands will not be displayed while in singleplayer, even when open to LAN players.
If a valid command name was specified, displays the usage for that command. For some complicated commands may show only the basic usage — additional information can sometimes be gained by attempting to type the command and using the auto-complete control (defaults to Tab ↹ key) to explore available options for each argument.
Examples
To display the first page of the command list: ? or help
To display the third page of the command list: ? 3
To display the usage for the help command: help help


kick[edit]

kick
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Alpha 1.0.16

Kicks a player off a server.

Syntax
kick <player> [reason …]
Description
Forcibly disconnects player from the server, displaying an optional reason to them.
Success Conditions
player must be online.


kill[edit]

kill
Restrictions

Operator

First introduced

1.3.1 (12w16a)

Kills entities (players, mobs, items, etc.).

Syntax
kill [player|entity]
Arguments
player|entity
Specifies the target(s) to be killed (including "non-living" entities like items, vehicles, etc.). Must be a player name or a target selector. If not specified, defaults to the command's user. Not optional in command blocks.
Result
Fails if player|entity fails to resolve to one or more entities (named players must be online).
On success, inflicts 1000 (Heart.svg × 500) void damage to targets, killing them instantly even if in Creative mode (a high-level Resistance effect cannot protect the targets either). The text "Ouch! That looks like it hurt." will be displayed to affected players in the chat.
Examples
To "kill" all item entities (making them vanish from the world): kill @e[type=Item]


list[edit]

list
Restrictions

Multiplayer
Operator

First introduced

Alpha 1.0.16_02

Lists players on the server.

Syntax
list
Description
Shows the names of all currently-connected players (the same can be achieved when pressing tab)
Success Conditions
Always succeeds, even in a command block.


me[edit]

me
Restrictions

None

First introduced

Classic 0.0.15a_03

Displays a message about yourself.

Syntax
me <action …>
Description
Sends a narrative message to the other players in the form of "* Yourname action" (e.g., "* Alice sneezes." or "* Alice exploded." ). If a multi-person target selector (e.g., @a) is used in action, the list of names is formatted as "name1, name2, and name3", or "name1 and name2" for two names. Therefore, regardless of any target selectors which are used in action, this command will only output once.
Success Conditions
All target selectors (e.g., @p) in action must evaluate.


op[edit]

op
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Alpha 1.0.16

Grants operator status to a player.

Syntax
op <player>
Description
Grants player operator status on the server.
Success Conditions
Always succeeds.


pardon[edit]

pardon, pardon-ip
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Alpha 1.0.16

Removes entries from the banlist.

Syntax
pardon <name>
pardon-ip <address>
Arguments
name
Specifies the name to remove from the banlist.
address
Specifies the IP address to remove from the banlist. Must be a valid IP address.
Result
Fails if arguments are not specified properly.
On success, if the name or the IP address is on the banlist, it is removed, allowing anyone to connect to the server by that name or from that IP address.


particle[edit]

particle
Restrictions

Operator

First introduced

1.8 (14w04a)

Creates particles.

Syntax
particle <name> <x> <y> <z> <xd> <yd> <zd> <speed> [count] [mode]
Arguments
name
Specifies the particle to create. Must be a particle name (for example, explode).
x y z
Specifies the position at which to create the particle. All values (including y) must be between -30,000,000 and 30,000,000 (inclusive, without the commas). May use tilde notation to specify a position relative to the command's execution.
xd yd zd
Specifies the size of the area to spawn particles in.
Exception: When name is reddust, mobSpell, or mobSpellAmbient and count is 0 or not specified, specifies the color of the particle in RGB format offset from the particle's default color (reddust's default is a near-red (a random red tint between 0.8 and 1.0), while the others default to black). For example, with reddust, 0 0 0 produces a red particle, -1 1 0 produces a green particle (red is reduced to 0 and green increased to 1), 0 0 1 produces a purple particle (blue is added to the original red), etc. With mobSpell or mobSpellAmbient, 0 0 0 produces a black particle, 0 1 0 produces a green particle, 0 0 0.5 produces a dark blue particle, etc. If count is greater than 0, colors are randomized.
speed
Specifies the speed of the particle. Must be at least 0.
count (optional)
Specifies the number of particle effects to create. Must be at least 0 (which produces one particle).
mode (optional)
Specifies the display mode. May be anything but only force will have an effect: to allow the particle(s) to be seen beyond the usual 16 block radius.
Result
Fails if arguments are not specified properly.
On success, creates the specified particle.
Examples
To create a stationary huge explosion particle 10 blocks to the east:
particle hugeexplosion ~10 ~ ~ 0 0 0 0


playsound[edit]

playsound
Restrictions

Operator

First introduced

1.6.1 (1.6.1-pre)

Plays a sound.

Syntax
playsound <sound> <player> [x] [y] [z] [volume] [pitch] [minimumVolume]
Arguments
sound
Specifies the sound to play. Must be a sound event defined in sounds.json (for example, mob.pig.say).
A sound event may be affiliated with multiple sounds, and the sound which is actually produced will be chosen at random from them, modified by their "weight", just as the game normally would. For example, the mob.pig.say sound event will play one of several pig sounds at random, because the event has multiple sounds associated with it.
Resource packs may add their own events to sounds.json; the command will successfully play these. File names are not used by this command; it strictly uses the events defined in sounds.json (which may not even be similar to the original file names and paths), and thus a resource pack adding new sound files must define events for them (this is not necessary when replacing old sounds which are already in defined events).
player
Specifies the sound's target. Must be a player name or a target selector.
x y z (optional)
Specifies the position to play the sounds from. May use tilde notation to specify a position relative to the target(s).
volume (optional)
Specifies the distance that the sound can be heard. Must be at least 0.0. For values less than 1.0, the sound will be quieter and have a smaller sphere within which it may be heard. For values greater than 1.0, the sound will not actually grow louder, but its audible range (a 16-block radius at 1.0) will be multiplied by volume. There will always be a gradual falloff to silence based on distance from the center of the sphere.
pitch (optional)
Specifies the pitch of the sound. Must be between 0.0 and 2.0 (inclusive) — values lower than 1.0 lower the pitch and increase the duration, values greater than 1.0 raise the pitch and reduce the duration. The minimum pitch is 0.5; smaller values will result in identical sounds. If not specified, defaults to 1.0.
minimumVolume (optional)
Specifies the volume for targets outside the sound's normal audible sphere. If a target is outside the normal sphere, the sound will instead be centered some short distance from the target (less than four blocks away), and minimumVolume will determine its volume. Must be between 0.0 and 1.0 (inclusive).
Result
Fails if arguments are not specified properly, if player fails to resolve to one or more online players, or if the targets are unable to hear the sound from where it is played.
On success, plays a sound for the targeted players.


publish[edit]

publish
Restrictions

Operator
No command blocks

First introduced

1.3.1 (12w24a)

Opens single-player world to the local network.

Syntax
publish
Description
Opens your single-player game for LAN friends to join. This command appears in the singleplayer cheats.
Success Conditions
Cannot be used in a command block.


replaceitem[edit]

replaceitem
Restrictions

Operator

First introduced

1.8 (14w26a)

Replaces items in the inventories of blocks (chest, furnaces, etc.) or entities (players or mobs).

Syntax
replaceitem block <x> <y> <z> <slot> <item> [amount] [data] [dataTag]
replaceitem entity <selector> <slot> <item> [amount] [data] [dataTag]
Arguments
x y z (block mode only)
Specifies the position of the block to be modified. May use tilde notation to specify a position relative to the command's execution.
selector (entity mode only)
Specifies the entity to modify. Must be a player name or target selector.
slot
Specifies the inventory slot to be modified. Valid values depend on whether a block or an entity is being modified.
For blocks, must be slot.container.slot_number where slot_number is replaced with a number specifying the slot.
  • Chests, dispensers, droppers, hoppers, and trapped chests are numbered 0 for the top-left slot and then increase first horizontally, then vertically (so, for example, a chest's top row slots are numbered 0 to 8 from left to right). Double chests and double trapped chests are treated as two single container blocks.
  • A brewing stand's bottom slots are numbered 0 to 2 from left to right, and its top slot is 3.
  • A furnace's slots are numbered 0 for the input slot, 1 for the fuel slot, and 2 for the output slot.
Other blocks which hold items but don't have inventory GUIs (flower pots and jukeboxes) can only be changed with /blockdata.
For entities, must be one of the following, where slot_number is replaced with a number specifying the slot:
Slot Slot Numbers Restrictions
slot.armor.chest armor stands, mobs, and players only (though not all mobs will show or make use of the items)
slot.armor.feet
slot.armor.head
slot.armor.legs
slot.weapon armor stands and mobs only (though not all mobs will show or make use of the items)
slot.enderchest.slot_number 0 to 26 players only
slot.hotbar.slot_number 0 to 8
slot.inventory.slot_number 0 to 26
slot.horse.saddle horses, donkeys, and mules only; item must be a saddle
slot.horse.armor horses only; item must be a type of horse armor
slot.horse.chest.slot_number 2 to 16 donkeys and mules with chests only
slot.villager.slot_number 0 to 7 villagers only
The inventory of an item frame can only be changed with /entitydata.
item
Specifies the item to be placed in the block or entity's inventory slot. Must be an item id, or a block id for which an item exists (for example, minecraft:golden_sword).
amount (optional)
Specifies the number of items to be placed in the block or entity's inventory slot. Must be between 1 and 64 (inclusive), even for items with a smaller stack size.
data (optional)
Specifies the item data for the item(s) to be placed in the block or entity's inventory slot. Must be an integer between -2,147,483,648 and 2,147,483,647 (inclusive, without the commas), but values which are invalid for the specified item id will default to 0. If not specified, defaults to 0.
dataTag (optional)
Specifies the data tag for the item(s) to be placed in the block or entity's inventory slot. Must be a compound NBT tag (for example, {display:{Name:Fred}}).
Result
Fails if arguments are not specified properly, if the specified block is not a container, if selector fails to resolve to one or more entities (named players must be online), or if the targeted entity does not have the specified slot (for example, zombies don't have slot.horse.armor).
On success, replaces the items in the specified slot with the specified items (previous items in that slot are lost).
Examples
To replace the items in the bottom-right slot of a single chest one block above with four spruce saplings:
replaceitem block ~ ~1 ~ slot.container.26 minecraft:sapling 4 1
To replace the items in the rightmost hotbar slot of the nearest player with four spruce saplings:
replaceitem entity @p slot.hotbar.8 minecraft:sapling 4 1
See also
/blockdata — can also replace items in a container
/entitydata — can also replace items in a mob's inventory, or modify the drop chances of armor and weapons
/give — give items to players without specifying specific inventory slots or overwriting other items


save[edit]

save
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Alpha 1.0.16_01

These commands manage server saves.


save-all[edit]

Saves the server to disk.

Syntax
save-all
Description
Forces the server to write all pending changes to the world and player data to disk.
Success Conditions
Always succeeds.


save-off[edit]

Disables automatic server saves.

Syntax
save-off
Description
Disables the server writing to the world files. All changes will temporarily be queued.
Success Conditions
Always succeeds.


save-on[edit]

Enables automatic server saves.

Syntax
save-on
Description
Enables the server writing to the world files. This is the default behavior.
Success Conditions
Always succeeds.


say[edit]

say
Restrictions

Operator

First introduced

Classic 0.0.16a_01

Says a message to multiple players.

Syntax
say <message …>
Description
Broadcasts message to all players on the server. If a multi-person target selector (e.g., @a) is used, the list of names is formatted as "name1, name2, and name3", or "name1 and name2" for two names. Therefore, regardless of any target selectors which are used, this command will only output once.
Success Conditions
All target selectors (e.g., @p) in the message must evaluate.


scoreboard[edit]

scoreboard
Restrictions

Operator

First introduced

1.5 (13w04a)

These commands manage scoreboard objectives, players, and teams.

Syntax
scoreboard <objectives|players|teams> …

See Scoreboard#Command reference for more information.


seed[edit]

seed
Restrictions

Operator

First introduced

1.3.1 (12w21a)

Displays the world seed.

Syntax
seed
Description
Displays the seed. This command can always be used in single-player mode, regardless of whether cheats are enabled or not.
Success Conditions
Always succeeds (if user is a command block, player in singleplayer, or server op).


setblock[edit]

setblock
Restrictions

Operator

First introduced

1.7.2 (13w37a)

Changes a block to another block.

Syntax
setblock <x> <y> <z> <TileName> [dataValue] [oldBlockHandling] [dataTag]
Arguments
x y z
Specifies the position of the block to be changed. May use tilde notation to specify a position relative to the command's execution.
TileName
Specifies the new block. Must be a block id (for example, minecraft:stone).
dataValue (optional)
Specifies additional data to further describe the new block. Must be between 0 and 15 (inclusive). If not specified, defaults to 0.
oldBlockHandling (optional)
Specifies how to handle the block change. Must be one of:
  • destroy — The old block drops both itself and its contents (as if destroyed by a player). Plays the appropriate block breaking noise.
  • keep — Only air blocks will be changed (non-air blocks will be "kept").
  • replace — The old block drops neither itself nor any contents. Plays no sound.
If not specified, defaults to replace.
dataTag (optional)
Specifies the data tag for the new block. Must be a compound NBT tag (for example, {CustomName:Fred}).
Result
Fails if arguments are not specified properly, if tried to change a non-air block in keep mode, or tried to replace a block with an identical copy in keep or replace mode.
On success, changes the block at the specified position.
See also
  • /blockdata — modifies the data tags of a block
  • /clone — copies blocks from one region to another
  • /fill — fills a region with a block


setidletimeout[edit]

setidletimeout
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Classic 0.0.15a_03

Sets the time before idle players are kicked from the server.

Syntax
setidletimeout <Minutes until kick>
Description
Set the idle kick timer. Any players idle for Minutes until kick will be kicked.
Success Conditions
Always succeeds.


setworldspawn[edit]

setworldspawn
Restrictions

Operator

First introduced

1.7.2 (13w43a)

Sets the world spawn.

Syntax
setworldspawn
setworldspawn <x> <y> <z>
Arguments
x y z (optional)
Specifies the coordinates of the world spawn. x and z must be within the range -30,000,000 to 30,000,000 (inclusive). y must be between 0 and 256 (inclusive). May use tilde notation to specify coordinates relative to the command's execution. If not specified, defaults to the position of the command's execution. Not optional in command blocks.
Players will always spawn on the top block near (x,z) — y is effectively ignored. Although spawn chunks are usually kept loaded at all times, new spawn chunks won't be loaded by this command until a player moves within range. Compasses (which in Minecraft point to the world spawn rather than north) will also not update to the change until the world is reloaded.
Result
Fails if arguments are not specified correctly.
On success, sets the world spawn to the specified coordinate.


spawnpoint[edit]

spawnpoint
Restrictions

Operator

First introduced

1.4.2 (12w32a)

Sets the spawn point for a player.

Syntax
spawnpoint
spawnpoint <player>
spawnpoint <player> <x> <y> <z>
Arguments
player (optional)
Specifies the player whose spawn point should be set. Must be a player name or a target selector. If not specified, defaults to the command's user. Not optional in command blocks.
x y z (optional)
Specifies the coordinates of the player's new spawn point. x and z must be integers within the range -30,000,000 to 30,000,000 (inclusive). y must be an integer between 0 and 256 (inclusive). May use tilde notation to specify coordinates relative to the command's execution. If not specified, defaults to the position of the specified player(s).
Result
Fails if arguments are not specified correctly, or if player fails to resolve to one or more online players.
On success, sets the spawn point of the targeted player(s) to the specified coordinate.


spreadplayers[edit]

spreadplayers
Restrictions

Operator

First introduced

1.6.1 (13w23a)

Teleports entities (players, mobs, items, etc.) to random surface locations within an area.

Syntax
spreadplayers <x> <z> <spreadDistance> <maxRange> <respectTeams> <player …>
Arguments
x z
Specifies the center of the region to spread targets to. x and z must be between -30,000,000 and 30,000,000 (exclusive). May use tilde notation to specify coordinates relative to the command's execution.
spreadDistance
Specifies the minimum distance between targets. Must be at least 0.0.
maxRange
Specifies the maximum distance on each horizontal axis from the center of the area to spread targets (thus, the area is square, not circular). Must be at least 1.0 greater than spreadDistance.
respectTeams
Specifies whether to keep teams together. Must be true or false. If true, targets on the same team will be teleported to the same location.
player
Specifies the targets to spread. Must be one or more player names and/or target selectors separated by spaces (@e is permitted to target entities other than players).
Result
Fails if arguments are not specified properly, if there are too many targets to satisfy the spreadDistance requirement within the specified area, or if a target is attempted to be spread to outside the world boundary.
On success, teleports targets to random surface locations within the specified area. Targets will always be placed on the top block at a location, and never on lava.
Examples
To teleport all players by team to random surface locations in a 1,000×1,000-block area centered on (0,0), with a minimum distance between teams of 200 blocks:
spreadplayers 0 0 200 500 true @a
To teleport one random player from each of three teams (Red, Blue, and Green), as well as Alice and Bob, to random surface locations in a 200×200-block area centered on (0,0), with a minimum distance between players of 50 blocks:
spreadplayers 0 0 50 100 false @r[team=Red] @r[team=Blue] @r[team=Green] Alice Bob
See also
/tp — teleports a single player or entity to a specific position (even underground).


stats[edit]

stats
Restrictions

Operator

First introduced

1.8 (14w28a)

Manages the updating of scoreboard objectives with the results of other commands.

Commands can be executed by blocks (specifically, command blocks and signs) or by entities (players can execute commands directly, and other entities can be the origin of commands indirectly with the /execute command). When a command is executed, the command returns one or more "command stats": the success count, number of blocks affected, number of entities affected, number of items affected, and/or a query result (such as from /time query daytime).

The stats command allows "selectors" and "objectives" to be set (or cleared) for each of these command stats for specific blocks or entities. Selectors (for example, @e) are stored exactly as entered, and don't get evaluated immediately. When a command is later run by the block or entity, the stored selector is then used to target (other) entities and update their scoreboard objective with the value of the command stat. That value can then be displayed or operated on, just like any other scoreboard value.

The success count from a command block can also be acquired with a redstone comparator, but that is capped at a maximum value of 15, while scoreboard objectives can hold any value from -2,147,483,648 to 2,147,483,647. Success counts and query results are also usually displayed in the chat.

See also: Tutorials/Command stats
Syntax
stats block <x> <y> <z> clear <stat>
stats block <x> <y> <z> set <stat> <selector> <objective>
stats entity <selector2> clear <stat>
stats entity <selector2> set <stat> <selector> <objective>
Arguments
x y z (block mode only)
Specifies the position of the block to post command stats from. x and z must be between -30,000,000 and 30,000,000 (inclusive, without the commas) and y must be between 0 and 256 (inclusive). May use tilde notation to specify a position relative to the command's execution.
selector2 (entity mode only)
Specifies the entity to post command stats from. Must be a player name or a target selector.
stat
Specifies the command stat whose selector and objective are to be cleared or set. Must be one of:
  • AffectedBlocks — returns the number of blocks affected by a command
  • AffectedEntities — returns the number of entities affected by a command
  • AffectedItems — returns the number of items affected by a command
  • QueryResult — returns the result of a command query
  • SuccessCount — returns a command's success count
selector (set mode only)
Specifies the selector to be evaluated when a command is run by the specified block or entity to determine which entity(ies) scoreboard objective is to be updated with the result returned by stat. May be anything because it won't be evaluated until a command is run by the specified block or entity, but only a player name or a target selector will produce useful results (though player names can be fake, so even real players don't need to be online).
objective (set mode only)
Specifies the name of the objective to be updated with the result returned by stat. May be anything because it won't be evaluated until a command is run by the specified block or entity, but only the name of a defined objective will produce useful results.
Result
Fails if arguments are not specified properly, if the specified block cannot track stats (in other words, it fails if the specified block is not a command block or sign), or if selector2 fails to evaluate to one or more valid entities (named players must be online).
On success, clears or sets the selector and objective to be updated with the result returned by stat.
Examples
To set the block at (0,64,0) to update scoreboard objective MyObj of the nearest player with the value of any query result returned by the block:
stats block 0 64 0 set QueryResult @p MyObj
To stop the block at (0,64,0) from updating any scoreboard obectives with the success count of commands it executes:
stats block 0 64 0 clear SuccessCount
To have the nearest wither skull update the scoreboard objective NumBlocks of fake player #FakePlayer with the number of blocks affected by commands executed by the wither skull:
stats entity @e[type=WitherSkull,c=1] set AffectedBlocks #FakePlayer NumBlocks
See also
/blockdata — can also change the selector and objectives of blocks by altering data tags directly
/entitydata — can also change the selector and objectives of entities by altering data tags directly


stop[edit]

stop
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Alpha 1.0.16

Stops a server.

Syntax
stop
Description
Saves all changes to disk, then shuts down the server.
Success Conditions
Always succeeds.


summon[edit]

summon
Restrictions

Operator

First introduced

1.7.2 (13w36a)

Summons an entity (mobs, projectiles, items, vehicles, etc.).

Syntax
summon <EntityName> [x] [y] [z] [dataTag]
Arguments
EntityName
Specifies the entity to be summoned. Must be an entity id (for example, Bat, EntityHorse, WitherSkull, XPOrb, PrimedTNT, etc.) or LightningBolt.
x y z (optional)
Specifies the position to summon the entity. x and z must be between -30,000,000 to 30,000,000 (inclusive), and y must be at least 0. May use tilde notation to specify a position relative to the command's execution. If not specified, defaults to the position of the command's execution.
dataTag (optional)
Specifies the data tag for the entity. Must be a compound NBT tag (for example, {CustomName:Fred}). Lightning has no additional data tags that can be specified.
Result
Fails if arguments are not specified properly.
On success, creates the specified entity at the specified position.
Examples
To summon a charged creeper named "Powered Creeper" at the current position:
summon Creeper ~ ~ ~ {powered:1,CustomName:Powered Creeper}
To summon lightning 10 blocks west of the current position:
summon LightningBolt ~-10 ~ ~
To summon an Armor stand wielding a lava bucket and wearing a skull:
/summon ArmorStand ~ ~ ~ {Equipment:[{id:lava_bucket},{},{},{},{id:skull}]}


tell[edit]

tell
Restrictions

None

First introduced

Alpha 1.0.16_02

Sends a private message to one or more players.

Syntax
tell <player> <private message …>
msg <player> <private message …>
w <player> <private message …>
Arguments
player
Specifies the targeted player(s) to send the private message to. Must be a player name (or a target selector, but only if the user is an operator).
private message
Specifies the message to send. May include spaces (as well as target selectors, but only if run from the server console — in other words, from the computer running the server, or by remote access to it).
Result
Fails if any target selectors in either argument fail to resolve to at least one online player, or if a named player is not online.
On success, only the targeted player(s) see the private message in their chat.
Any target selectors in the private message will each resolve to one or more player names (as "name" for a single player, "name1 and name2" for two players, or "name1, name2, …, and nameN" for N players, without the quotes).
Examples
To privately tell Alice to start the mission: tell Alice Start the mission!


tellraw[edit]

tellraw
Restrictions

Operator

First introduced

1.7.2 (13w37a)

Sends a JSON message to players.

Syntax
tellraw <player> <raw json message>
Arguments
player
Specifies the player(s) to send the message to. Must be a player name or target selector.
raw json message
Specifies the message to send. Must be valid raw JSON text (for example, {text:"Hi there!",bold:true}).
Result
Fails if arguments are not specified properly, or if player fails to evaluate to one or more online players.
On success, the targeted players receive the JSON message in their chat.
See also
/say — send a simple text message to all players
/tell — send a simple text message to specific players


testfor[edit]

testfor
Restrictions

Operator

First introduced

1.5 (13w03a)

Counts entities (players, mobs, items, etc.) matching specified conditions.

Syntax
testfor <player> [dataTag]
Arguments
player
Specifies the targets to count. Must be a player name or a target selector (@e is permitted to target entities other than players).
dataTag (optional)
Specifies the data tags the entities must have to match successfully. Must be a compund NBT tag (for example, {XpLevel:3}).
Result
Fails if arguments are not specified properly, or if player fails to resolve to one or more entities (named players must be online).
On success, produces a success count equal to the number of targets matching player, which can be measured by a redstone comparator facing away from the command block.
Examples
To test if Alice is online: testfor Alice
To count the number of players in survival mode within a 3-block radius of (0,64,0): testfor @a[0,64,0,3,m=0]
To count the number of players currently flying: testfor @a {abilities:{flying:1b}}
To count the number of zombies within a 20-block radius of (0,64,0): testfor @e[0,64,0,20,type=Zombie]


testforblock[edit]

testforblock
Restrictions

Operator

First introduced

1.7.2 (13w37a)

Tests whether a certain block is in a specific location.

Syntax
testforblock <x> <y> <z> <TileName> [dataValue] [dataTag]
Arguments
x y z
Specifies the position of the block to test. x and z must be between -30,000,000 and 30,000,000 (inclusive, without the commas) and y must be between 0 and 255 (inclusive). May use tilde notation to specify a position relative to the command's execution.
TileName
Specifies the block to test for. Must be a valid block id (for example, minecraft:stone).
dataValue (optional)
Specifies the block data to test for. dataValue must be between -1 and 15 (inclusive). If not specified, or if -1, dataValue matches any block data value.
dataTag (optional)
Specifies the block data tags to test for. Must be a compound NBT tag (for example, {CustomName:Fred}). If not specified, dataTag matches any block data tag.
Result
Fails if arguments are not specified properly, if the block at the specified position does not match the specified block id or data, or if the specified data tag has different values than are defined in the block's data tag (dataTag does not need to match the block's entire data tag, and data tags in the argument which are undefined in the block will not cause the command to fail).
On success, returns a success count of 1.
Examples
To test if the block at (0,64,0) is any type of wool:
testforblock 0 64 0 minecraft:wool
testforblock 0 64 0 minecraft:wool -1
To test if the block at (0,64,0) is orange wool:
testforblock 0 64 0 minecraft:wool 1
To test if the block below is a jukebox with the "mall" record inside:
testforblock ~ ~-1 ~ minecraft:jukebox -1 {Record:2261}


testforblocks[edit]

testforblocks
Restrictions

Operator

First introduced

1.8 (14w07a)

Tests whether the blocks in two regions match.

Syntax
testforblocks <x1> <y1> <z1> <x2> <y2> <z2> <x> <y> <z> [mode]
Arguments
x1 y1 z1 and x2 y2 z2
Specifies two opposing corners of the region to use as the pattern to test for (the "source region"). x1, z1, x2, and z2 must all be between -30,000,000 and 30,000,000 (inclusive, without the commas), and y1 and y2 must be between 0 and 255 (inclusive). May use tilde notation to specify coordinates relative to the command's position. The number of blocks in the source region must not exceed 524,288.
x y z
Specifies the lower northwestern corner (the corner with the most-negative values) of the region to be checked (the "destination region"). x and z must both be between -30,000,000 and 30,000,000 (inclusive, without the commas), and y must be between 0 and 254 (inclusive). May use tilde notation to specify coordinates relative to the command's position. Source and destination regions may overlap.
mode (optional)
Specifies how to match blocks. Must be one of:
  • all — every block in the source and destination regions must match exactly.
  • maskedair blocks in the source region will match any block in the destination region.
If not specified, defaults to all.
Result
Fails if arguments are not specified properly, or if the source and destination regions do not match.
On success, returns the number of matching blocks (the total number of blocks in all mode, or the number of source region non-air blocks in masked mode).


time[edit]

time
Restrictions

Operator

First introduced

1.3.1 (12w16a)

Changes or queries the world's game time.

Syntax
time <add|query|set> <value>
Arguments
value
Specifies the time to add, query, or set:
  • add - Must be between 0 and 2,147,483,647 (inclusive, without the commas)
  • query - Must be daytime or gametime.
  • set - Must be between 0 and 2,147,483,647 (inclusive, without the commas), day, or night.
Result
Fails if arguments are not specified properly.
On success:
  • add - adds value to the world's game time
  • query - returns the day time (game ticks since midnight) or the game time (game ticks since world start)
  • set - sets the world game time to value (day = 1,000, night = 13,000).
Examples
To set the time to 1,000: time set 1000 or time set day
To add one day to the world time: time add 24000


title[edit]

title
Restrictions

Operator

First introduced

1.8 (14w20a)

Manages screen titles.

Screen titles are displayed to players as a single line of large center-aligned text in the middle of their displays and can include a second line of text called a "subtitle". Both lines can include complicated formatting. Screen titles can be set to fade in and fade out, and the duration they are displayed can also be specified. Screen titles scale in size with the GUI Scale and screen titles which are too big to fit on the screen are not line-wrapped (they just overflow off the screen on both sides).

Syntax
The command has five variations, each with different arguments.
title <player> clear (removes a screen title from the screen)
title <player> reset (resets options to default values)
title <player> subtitle <raw json title> (specifies the subtitle text)
title <player> times <fadeIn> <stay> <fadeOut> (specifies fade-in, stay, and fade-out times)
title <player> title <raw json title> (displays the screen title)
Arguments
player
Specifies the player(s) to display a screen title to. Must be a player name or target selector.
raw json title (subtitle and title mode only)
Specifies the text to display as a title or subtitle. Must be valid raw JSON text (for example, {text:"Chapter I",bold:true}).
fadeIn, stay, and fadeOut (times mode only)
Specifies the time in game ticks (1/20ths of a second) for the screen title to fade in, stay, and fade out. All values must be between -2,147,483,648 and 2,147,483,647 (inclusive, without the commas), but values below 0 will be treated as 0. If not specified (or if reset), default to 20 (1 second), 60 (3 seconds), and 20 (1 second).
Result
Example result of the title command.
Fails if arguments are not specified properly, or if player fails to evaluate to one or more online players.
On success:
  • clear — Clears the screen title from the screens of the specified player(s). If no screen title is currently being displayed, has no effect.
  • reset — Resets the subtitle text to blank text, the fade-in time to 20 (1 second fade-in), the stay time to 60 (3 seconds), and the fade-out time to 20 (1 second fade-out) for the specified player(s).
  • subtitle — If a screen title is currently being displayed to the specified player(s), changes the currently-displayed subtitle to the new specified text; otherwise, specifies the subtitle for the next screen title to be displayed to the specified player(s).
  • times — If a screen title is currently being displayed to the specified player(s), changes the fade-in, stay, and fade-out times of the current screen title (and of all future screen titles); otherwise, specifies the times for future screen titles to be displayed to the specified player(s).
  • title — Displays the specified text to the specified player(s), or changes the currently-displayed text to the new specified text. After fade-out, resets the subtitle back to blank text, but does not reset fade-in, stay, and fade-out times.
Examples
To display a bold screen title "Chapter I" with a gray italic subtitle "The story begins…" to all players:
  1. title @a subtitle {text:"The story begins…",color:gray,italic:true}
  2. title @a title {text:"Chapter I",bold:true}


toggledownfall[edit]

toggledownfall
Restrictions

Operator

First introduced

1.3.1 (12w16a)

Toggles the weather.

Syntax
toggledownfall
Result
Always succeeds. If weather is currently clear, rain or snow starts. If weather is currently rain or snow, stops.


tp[edit]

tp
Restrictions

Operator

First introduced

Alpha 1.0.16_01

Teleports entities (players, mobs, items, etc.).

Syntax
tp [target player] <destination player>
tp [target player] <x> <y> <z> [<y-rot> <x-rot>]
Arguments
target player (optional)
Specifies the targets to be teleported. Must be either a player name or a target selector (@e is permitted to target entities other than players). If not specified, defaults to the command's user. Not optional in command blocks.
destination player
Specifies the targets to teleport the target player to. Must be either a player name or a target selector (@e is permitted to target entities other than players).
x y z
Specifies the coordinates to teleport the targets to. x and z must fall within the range -30,000,000 to 30,000,000 (exclusive, without the commas), and y must be at least 0. May use tilde notation to specify a position relative to the target's current position.
y-rot (optional)
Specifies the horizontal rotation (-180.0 for due north, -90.0 for due east, 0.0 for due south, 90.0 for due west, to 179.9 for just west of north, before wrapping back around to -180.0). Tilde notation can be used to specify a rotation relative to the target's previous rotation.
x-rot (optional)
Specifies the vertical rotation (-90.0 for straight up to 90.0 for straight down). Tilde notation can be used to specify a rotation relative to the target's previous rotation.
Result
Fails if the arguments are not specified correctly, if target player fails to resolve to one or more entities (named players must be online), or if destination player fail to resolve to a single entity (a named player must be online).
On success, teleports the targets to the specified destination.
Examples
To teleport yourself to Alice: tp Alice
To teleport all players to yourself: tp @a @p
To teleport yourself to (x,z) = (100,100) but three blocks above your current position: tp 100 ~3 100
To rotate the nearest player 10 degrees to the right without changing their position: tp @p ~ ~ ~ ~10 ~


trigger[edit]

trigger
Restrictions

None

First introduced

1.8 (14w06a)

Sets a trigger to be activated.

Syntax
trigger <objective> <add|set> <value>
Description
Used together with /tellraw to let players activate systems made by operators or mapmakers. The objective must be an enabled scoreboard objective of the criteria "trigger". The given value is either added to its existing value, or becomes its new value, depending on whether the second argument is add or set. The value of the objective is only changed for the player who uses the command.
Success Conditions
objective must have the "trigger" criteria and the player who is running the command must be able to modify objective.


weather[edit]

weather
Restrictions

Operator

First introduced

1.4.2 (12w32a)

Sets the weather.

Syntax
weather <clear|rain|thunder> [duration in seconds]
Arguments
clear
Specifies to set the weather to clear weather.
rain
Specifies to set the weather to rain (or snow in cold biomes).
thunder
Specifies to set the weather to a thunderstorm (or a thunder snowstorm in cold biomes).
duration in seconds
Specifies the time for the specified weather to last. Must be between 1 and 1,000,000 (inclusive, without the commas).
Result
Fails if arguments are not specified properly.
On success, changes the weather for the specified duration (in seconds).
Examples
To get clear weather for one Minecraft day: weather clear 1200
To make it rain, but let it end at its own pace: weather rain 1


whitelist[edit]

whitelist
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Beta 1.3

Manages the server whitelist.

Server ops will always be able to connect when the whitelist is active, even if their names do not appear in the whitelist.

Syntax
The command has six variations.
whitelist add <player>
whitelist list
whitelist off
whitelist on
whitelist reload
whitelist remove <player>
Arguments
player (add and remove mode only)
Specifies the player(s) to add or remove from the whitelist.
Result
Always succeeds.
On success:
  • add — Adds the player name to the whitelist. The player does not need to be online or even real.
  • list — Displays all player names in the whitelist.
  • off — Disables the server's use of a whitelist.
  • on — Enables the server's use of a whitelist.
  • reload — Reloads the list of player names in white-list.txt (1.7.5 or earlier) or whitelist.json (1.7.6 or later) from disk (used when white-list.txt or whitelist.json has been modified outside of Minecraft).
  • remove — Removes the player name from the whitelist. The player does not need to be online or even real.


worldborder[edit]

worldborder
Restrictions

Operator

First introduced

1.8 (14w17a)

These commands manage the world border.

Syntax
The command has eight variations, each with different arguments:
worldborder add <sizeInBlocks> [timeInSeconds] (increases the world border diameter)
worldborder center <x> <z> (recenters the world boundary)
worldborder damage amount <damagePerBlock> (specifies world border damage rate)
worldborder damage buffer <sizeInBlocks> (specifies world border damage buffer distance)
worldborder get (returns the world border diameter)
worldborder set <sizeInBlocks> [timeInSeconds] (sets the world border size and speed)
worldborder warning distance <blocks> (specifies the world border warning distance)
worldborder warning time <seconds> (specifies the world border warning time)
Arguments
sizeInBlocks (add, damage buffer, and set modes only)
Specifies a distance in blocks:
  • add — specifies the number of blocks to add to the world border diameter.
  • damage buffer — specifies the distance outside the world buffer before players start taking damage. Must be at least 0.0. Initially set to 5.0.
  • set — Specifies the new diameter for the world border. Must be between 1.0 and 60,000,000 (inclusive, without the commas).
timeInSeconds (add and set modes only)
Specifies the number of seconds it should take for the world border to move from its current diameter to the new diameter. Must be at least 0. If not specified, defaults to 0.
x z (center mode only)
Specifies the horizontal coordinates of the world border's center. Must be between -30,000,000 and 30,000,000 (inclusive, without the commas). May use tilde notation to specify coordinates relative to the command's execution.
damagePerBlock (damage amount mode only)
Specifies the damage a player takes per second per block past the world border buffer. For example, if damagePerBlock is 0.1, a player 5 blocks outside the world border buffer will take 0.5 damage per second (damage less than half a heart might not change the visual health display, but will still accumulate). Must be at least 0.0. Initially set to 0.2.
blocks (warning distance mode only)
Specifies the distance from the world border at which players will begin to see a visual warning of the world border's proximity. Must be at least 0. Initially set to 5.
seconds (warning time mode only)
Specifies the time in seconds before a moving world border overruns a player when they will begin to see a visual warning of the world border's proximity. For example, if seconds is 5, players will get a visual warning when the moving world border is 5 seconds or less away from passing their position. Must be at least 0. Initially set to 15.
Result
Fails if arguments are not specified properly, or if new world diameter will be less than 1.0 or greater than 60,000,000.
On success:
  • add — The world border begins changing its diameter. If sizeInBlocks is positive, the world border will turn green and start increasing; if negative, the world border will turn red and start decreasing. If timeInSeconds is 0 or unspecified, the change occurs immediately; otherwise the change proceeds at a rate of (sizeInBlocks/2)/timeInSeconds blocks per second.
  • center — The center of the world border immediate moves to the specified coordinates.
  • damage amount — Sets the world border damage amount to the specified value. Any player outside the world border buffer will take this amount of damage per second per block past the world border buffer distance.
  • damage buffer — Sets the world border buffer distance to the specified value. Players won't take damage until they move past this distance from the world border.
  • get — Shows the current world border diameter in the chat.
  • set — The world border begins changing its diameter. If sizeInBlocks is bigger than the current diameter, the world border will turn green and start increasing; if smaller, the world border will turn red and start decreasing. If timeInSeconds is 0 or unspecified, the change occurs immediately; otherwise the change proceeds at a rate of ((sizeInBlocks-<cirrent diameter>)/2)/timeInSeconds blocks per second.
  • warning distance — Sets the world border warning distance to this value.
  • warning time — Sets the world border warning time to this value.


xp[edit]

xp
Restrictions

Operator

First introduced

1.3.1 (12w16a)

Adds experience to a player.

Syntax
xp <amount> [player]
xp <amount>L [player]
Arguments
amount
Specifies the amount of experience to give to the player. Must be between 0 and 2,147,483,647 (inclusive, without the commas).
If an L is added to the end, adds levels instead. Levels must be between -2,147,483,648 and 2,147,483,647 (inclusive, without the commas) — negative values remove levels instead of adding them.
player (optional)
Specifies the target of the command. Must be a player name or a target selector. If not specified, defaults to the command's executor. Not optional in command blocks.
Result
Fails if arguments are not specified properly, or if player fails to resolve to one or more online players.
On success, adds experience or adds/removes levels. Total experience and levels will not be reduced below 0.
Examples
To give 7 experience to yourself: xp 7
To give 3 levels to Alice: xp 3L Alice
To remove all levels from all players: xp -2147483648L @a


Video[edit]

History[edit]

Classic
0.0.15a_03 Added /broadcast.
0.0.16a_01 Changed /broadcast to /say.
0.0.17a Added /setspawn.
One of the first singleplayer commands.
0.0.20 Added /solid.
The first multiplayer commands.
Alpha
1.0.16 Added /ban, /ban-ip, /banlist, /deop, /home, /kick, /op, /pardon, /pardon-ip and /stop.
1.0.16_01 Added /save-all, /save-on, /save-off and /tp.
1.0.16_02 Added /list and /tell.
1.2.5 Removed /home.
1.2.6 Added /kill.
Beta
1.3 Added /whitelist.
Official release
1.3.1 12w16a Added cheats mode and /gamemode, /give, /time, /toggledownfall, and /xp.
The first operator commands.
12w17a Added /help.
12w21a Added /seed.
12w22a Added /defaultgamemode.
12w24a Added /publish.
12w25a Cheats can now be turned on or off when opening a world to other players through LAN.
12w27a Added /debug.
1.4.2 12w32a Added /difficulty, /gamerule, /spawnpoint, and /weather.
Added target selectors.
12w37a Added /clear.
12w38a Added item arguments to /clear.
12w41a The limit for /xp is now 2,147,483,647 instead of 5,000.
1.4.4 1.4.4-pre Added /enchant.
1.5 13w03a Added /testfor.
13w04a Added /scoreboard.
13w09b Added /effect.
1.6.1 13w23a Added /spreadplayers.
Added gamerule naturalRegeneration.
13w24a Added gamerule doDaylightCycle.
1.6-pre Added clear argument to /effect.
1.6.1-pre Added /playsound.
1.7.2 13w36a Added /summon.
Added /achievement.
Added dataTag argument to /give.
13w37a Added /setblock, /tellraw, and /testforblock.
13w38a Added /setidletimeout.
13w43a Added /setworldspawn.
1.8 14w02a Added /blockdata.
Added @e target selector.
Added player|entity argument to /kill.
Added data argument to /clear.
Added dataTag argument to /testfor.
/testfor is no longer exclusive to command blocks.
Added insertion attribute to raw JSON text specification.
14w03a Added rotation arguments to /tp.
Added dx, dy, and dz to target selector arguments.
Added /clone and /fill.
Added gamerule logAdminCommands.
14w04a Added /particle.
14w05a Added spectator to /gamemode and /defaultgamemode.
14w06a Added hideParticles argument to /effect.
Added /trigger.
14w07a Added /execute and /testforblocks.
/testfor can now test for partial NBT tag matches.
14w08a Commands run using /execute now pass their success value back to the command block running them.
14w10a Added gamerule showDeathMessages.
Added force option to /clone.
14w17a Added /worldborder.
Added gamerule randomTickSpeed.
14w19a Added /worldborder damage and /worldborder warning.
14w20a Added /title.
Added selector attribute to raw JSON text specification.
Added move option to /clone.
14w26a Added /worldborder add.
Added /replaceitem.
Added gamerule sendCommandFeedback
14w28a Added /stats.
14w29a Added /worldborder get.
Added force argument to /particle.
Added /time query.
Added the ability to create dummy gamerules.
Added QueryResults to /stats.
14w30a /summon can now spawn lightning.
14w31a /debug can be run in single player.
Added chunk argument to /debug.
14w32b Added /entitydata.
/give no longer can stack any item.
Upcoming
1.8.1 1.8.1-pre1 Added the game rule doEntityDrops.
The game rule doTileDrops no longer effects entities.

Issues[edit]

Issues relating to "Commands" are maintained on the issue tracker. Report issues there.

See also[edit]