Namespaces

Variants

Share

Share
Views
Actions

Commands

From Minecraft Wiki
(Redirected from Op Commands)
Jump to: navigation, search

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

Contents

[edit] Usage

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.

[edit] Tilde notation

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 poitive or negative direction for that axis. A single tilde by itself is shorthand for ~0.

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

Usually you can mix absolute coordinates with relative coordinates. For example, tp ~ 64 ~ will keep your "x" and "z" coordinates the same, but teleport you 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.

[edit] Target selectors

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, you might write:

/gamemode creative @a[team=Red]

[edit] Target selector variables

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

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

@p
Target the nearest player.
@r
Target a random player.
@a
Target all players.

Target selector variables can be used by themselves, or can be further modified with target selector arguments.

The following target selector variable has appeared in development versions but has not yet been released in a full version:

@e
Target all entities (including players).

[edit] Target selector arguments

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 arguments 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.

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 (max, min)
score_name max score
score_name_min min score
team team name
name player name
Upcoming
dx, dy, dz volume dimensions
rx, rxm vertical rotation (max, min)
ry, rym horizontal rotation (max, min)
type entity type
Selecting targets by coordinate
[x=X,y=Y,z=Z]
Selects only targets at that exact position (ignoring fractions). Use tilde notation to specify a coordinate relative to the command's execution position.
Selecting targets by radius
[r=R,rm=RM]
Selects only targets within specified radius/i from the position where the command was executed. r specifies the maximum radius that targets can be from the coordinate, and rm specifies the minimum radius. It is possible to use either without the other (r to specify targets within a certain radius, and rm to specify targets further than a certain radius).
If coordinate and radius/i are both defined, the radius 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.
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 game mode
[m=M]
Selects only targets with the specified game mode. Permitted value for M are:
  • -1: all game modes
  • 0: creative mode
  • 1: survival mode
  • 2: adventure mode
In the current snapshots, M may also be 3 for spectator mode.
Selecting targets by count
[c=C]
Selects only the specified number of targets. 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 negative value, the order of targets is reversed (for example, @p[c=-3] will return the three farthest targets). When used without position selection, targets are returned in the order of creation (for example, c=1 will select the first target created and 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.
Selecting targets by team
[team=TEAM]
Selects only targets on team TEAM.
[team=!TEAM]
Selects only targets not on team TEAM.
Selecting targets by name
[name=NAME]
Selects only targets named NAME.
[name=!NAME]
Selects only targets not named NAME.

The following target selector arguments have appeared in development versions but have not yet been released in a full version:

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., south), DY blocks in the positive "y" direction (i.e., upwards), and DZ blocks in the positive "z" direction (i.e., east). 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
Vertical rotation values vary from -90.0 facing straight up to 90.0 facing straight down (thus vertical rotation values increase with rotation downwards).
[rx=RX]
Selects only targets with a maximum vertical rotation of RX.
[rxm=RXM]
Selects only targets with a minimum vertical rotation of RXM.
Selecting targets by horizontal rotation
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).
[ry=RY]
Selects only targets with a maximum horizontal rotation of RY.
[rym=RYM]
Selects only targets with a minimum horizontal rotation of RYM.
Selecting targets by type
Primarily only used with the @e variable (because all players are type=Player). "Entity types" are the entity IDs used to identify different types of entities internally (see chunk format).
[type=TYPE]
Selects only targets of the specific entity type.
[type=!TYPE]
Selects only targets not of the specific entity type.

[edit] Data tags

NBT tags can be specified for items and entities created with the /give, /summon and other commands. Data tags are data structures. The format is JSON, although it is not strict (lenient). The data is represented as a comma separated list of pairs. Each pair has the format <key>:<value>. The key is the name of the NBT tag and the value is the data that should be assigned to it. Tag names are case-sensitive, and whitespace outside keys or values is ignored.

The value can be different types:

  • String is a piece of text, can be wrapped with double-quotes. Double quotes have to be used if the String contains commas, curly braces or square brackets. To use double-quotes inside Strings, the quote is escaped by a backslash (\"). When using most commands, escaping is disabled (except for double quotes) and keys must not be quoted (probably a bug [1]). This causes an issue where trailing backslashes do not work (as do any other things that need to be escaped), even when escaped properly. The reason is that it escapes the quotation mark after the string which causes a malformed JSON object. Example:"My name is \"Steve\""
  • Number are 1 or more digits that can have a leading sign (+/-). They're classified in Integers, that don't have a decimal mark, Doubles, that uses a dot (.) as a decimal mark, and Floats, that also have f appended after the number. Examples: integer:-128; double:-1.2345; & float:1.2f
  • List (or 'Array') is multiple, comma separated values wrapped with square brackets. The containing values do not need to be of the same type. Example:[1,2,3]
  • Boolean can either be true or false, but using Numbers works, too. When using numbers, 0 is false, everything else is true. Example:true
  • Compound or 'Object' is a container for data structures (as explained above). They are wrapped with curly braces.
Notice: The Data tag itself is a Compound. Example: {Health:18,CustomName:"Friend"}
  • null This is a placeholder an empty value. Do not put quotes. Example:null

When commands such as /testfor, /testforblock, and /clear are used to match NBT tags, they only check for the presence of the given 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/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.

For a complete listing of defined tags (though not all can be modified by commands), see:

For a complete list of identifiers, see:

[edit] Raw JSON Text

The /tellraw command uses a specific lenient JSON format for raw chat messages. Similar to the NBT format notation above, concepts such as Strings, Objects (Compounds), and Lists are used to represent the various properties of raw chat.

For a direct tutorial to tellraw commands, see this thread. For a tool to easily create tellraw commands, see this. Note that both links are external to the Minecraft Wiki and may be outdated.

The format of "<raw JSON message>" 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.

    •  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), 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 string 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 for 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.

[edit] List of commands

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

[edit]  ?

Alternate syntax for /help.

[edit] achievement

Gives a player an achievement or increases a statistic.

[edit]achievement
Restrictions

Operator

First introduced

1.7.2 (13w36a)

Syntax
achievement give <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
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 the specified achievement (and all prerequisite achievements) to the player(s) or increases 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 Notch: achievement give achievement.openInventory Notch
To increase the "Mob Kills" statistic by 1 for the nearest player: achievement give stat.mobKills @p
See also
Commands to modify player:

[edit] ban

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

[edit] ban

Adds player to banlist.

[edit]ban
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Classic 0.0.15a_03

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.

[edit] ban-ip

Adds IP address to banlist.

[edit]ban-ip
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Classic 0.0.15a_03

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.

[edit] banlist

Displays banlist.

[edit]banlist
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Classic 0.0.15a_03

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

[edit] blockdata

Modifies the data tag of a block.

[edit]blockdata
Restrictions

Operator

First introduced

1.8 (14w02a)

Syntax
blockdata <x> <y> <z> <dataTag>
Arguments
x y z
The coordinates of the block to be modified. May be provided in tilde notation to identify a position relative to where the command was initiated.
dataTag
The data tag elements to be added to, or overwrite elements of, the specified block.
Result
Fails if dataTag is not a valid data tag specification for the targeted block.
On success, modifies the data tag of the targeted block.
See also
  • /replaceitem — replaces items in a block's inventory
  • /setblock – places a new block at a position
  • /stats — sets a block's CommandStats
  • /testforblock — checks if a specifc block is at a specific position

[edit] clear

Clears items from player inventory.

[edit]clear
Restrictions

Operator

First introduced

1.4.2 (12w37a)

Syntax
clear [player] [item] [data]
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.
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 Notch's inventory: clear Notch
To clear all wool items from Notch's inventory: clear Notch minecraft:wool
To clear all orange wool items from the inventory of all players: clear @a minecraft:wool 1
Future
Two additional arguments have appeared in development versions, but have not yet appeared in a full release:
clear [player] [item] [data] [maxCount] [dataTag]
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).
In addition, 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.
For example, 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

[edit] clone

Clones blocks from one region to another.

[edit]clone
Restrictions

Operator

First introduced

1.8 (14w03a)

Syntax
clone <x1> <y1> <z1> <x2> <y2> <z2> <x> <y> <z> [mode] [mode2] [TileName]
The in-game help for the clone command does not yet list the final two arguments. mode2 and TileName are placeholder names 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.
mode (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.
mode2 (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 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 mode. Not optional when using filtered 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 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 mode).
See also
/fill — fill a region with a block

[edit] debug

Starts or stops a debugging session.

[edit]debug
Restrictions

Operator
No command blocks

First introduced

1.3.1 (12w27a)

Syntax
debug <start|stop>
Description
Starts a new debug profiling session or stops the session currently running. It notifies about potential performance bottlenecks in the console when active and creates a profiler results file in the folder debug when stopped.
Success Conditions
Can only stop if a session is running.

[edit] defaultgamemode

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

[edit]defaultgamemode
Restrictions

Operator

First introduced

1.3.1 (12w22a)

Syntax
defaultgamemode <mode>
Arguments
mode
Must be one of three values:
  • 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
"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
  • defaultgamemode 0
Future
An additional value for the mode argument has appeared in development versions, but has not yet appeared in a full release:
  • spectator (can be abbreviated as sp or 3) for spectator mode
See also
/gamemode – changes a player's game mode

[edit] deop

Revoke op status from a player.

[edit]deop
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Classic 0.0.15a_03

Syntax
deop <player>
Description
Revokes a player's operator status.
Success Conditions
Always succeeds.

[edit] difficulty

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

[edit]difficulty
Restrictions

Operator

First introduced

1.4.2 (12w32a)

Syntax
difficulty <new difficulty>
Arguments
new difficulty
Must be one of four values:
  • 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
  • difficulty 3
See also
/gamemode – changes a player's game mode (creative, survival, etc.)

[edit] effect

These commands manage status effects on players.

[edit] effect

Adds or removes a status effect to or from players.

[edit]effect
Restrictions

Operator

First introduced

1.5 (13w09b)

Syntax
effect <player> <effect> [seconds] [amplifier]
Arguments
player
Specifies the target(s). Must be a player name or a target selector.
effect
Specifies the effect to grant. Must be a status effect id.
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.
Result
Fails if arguments are not specified correctly, if player fails to resolve to one or more online players, or if seconds was specified as 0 and the target did not have the effect.
On success, adds the status effect to the target. If the 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
Future
The upcoming @e target selector allows effects to be given to any entity, not just players.
Effects may be specified by name id (for example, minecraft:speed).
An additional argument has been added:
effect <player> <effect> [seconds] [amplifier] [hideParticles]
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.

[edit] effect clear

Clears all status effects from players.

[edit]effect clear
Restrictions

Operator

First introduced

1.6.1 (1.6pre)

Syntax
effect <player> clear
Arguments
player
Specifies the target(s). Must be a player name or a target selector.
Result
Fails if player does not resolve to one or more online players, or if no effects are removed.
On success, clears all effects from the specified players.
Examples
To clear all effects from all players: effect @a clear
Future
The upcoming @e target selector allows effects to be cleared from any entity, not just players.

[edit] enchant

Adds an enchantment to a player item.

[edit]enchant
Restrictions

Operator

First introduced

1.4.4 (1.4.4pre)

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.
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 other enchantments.
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
Future
Enchantments may be specified by name id (for example, minecraft:sharpness).

[edit] execute

These commands can change the user and position of another command's execution.

[edit] execute

Executes a command with a different user and position.

[edit]execute
Restrictions

Operator

First introduced

1.8 (14w07a)

Syntax
execute <entity> <x> <y> <z> <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.
Result
Fails if arguments are not specified properly, if entity fails to resolve to one or more valid entities (named players must be online), 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

[edit] execute detect

Executes a command with a different user and position, but only if a certain block is detected.

Syntax
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.
x2 y2 z2
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 data
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.
command
Specifies the command to be run. Must be a valid command.
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 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)

[edit] fill

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

[edit]fill
Restrictions

Operator

First introduced

1.8 (14w03a)

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 a valid block data for the specified block id.
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 valid data tag for the specified block id. 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, or if no blocks were changed.
On success, changes blocks in the fill region to the specified block.

[edit] gamemode

Sets a player's game mode.

[edit]gamemode
Restrictions

Operator

First introduced

1.3.1 (12w16a)

Syntax
gamemode <mode> [player]
Arguments
mode
Must be one of three values:
  • 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
"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 or gamemode c
To put all players into survival mode: gamemode 0 @a
Future
An additional value for the mode argument is available:
  • spectator (can be abbreviated as sp or 3) for spectator mode
See also
defaultgamemode – sets the initial game mode for players joining the world

[edit] gamerule

Sets or queries a game rule value.

[edit]gamerule
Restrictions

Operator

First introduced

1.4.2 (12w32a)

Syntax
gamerule <rule name> [value]
Arguments
rule name
Specifies the game rule to set or query. May be any value, but game rules which affect actual game play include:
  • commandBlockOutput - Whether command blocks should notify admins when they perform commands
  • doDaylightCycle - Whether time progresses
  • doFireTick - Whether fire should spread and naturally extinguish
  • doMobLoot - Whether mobs should drop items
  • doMobSpawning - Whether mobs should naturally spawn
  • doTileDrops - Whether blocks should have drops
  • keepInventory - Whether the player should keep items in their inventory after death
  • mobGriefing - Whether creepers, endermen, ghasts, withers and villagers should be able to change blocks and whether zombies, skeletons, and zombie pigmen can pick up items
  • 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.)
value (optional)
Specifies the value to set the game rule to. May be any value, though only values of true or false specified for predefined game rules will actually affect game play.
Result
Always succeeds, even for fake game rules and nonsense values.
Sets the game rule to the specified value. If value is not specified, displays the game rule's current value in the chat.
Examples
To stop the day-night cycle: gamerule doDaylightCycle false
To stop natural healing: gamerule naturalRegeneration false
Future
The following game rules have appeared in development versions, but the full update containing these features has not been released yet.
  • logAdminCommands - Whether to log admin commands to server log
  • randomTickSpeed - How often a random tick occurs (such as plant growth, leaf decay, etc.) per chunk section per game tick. Like other game rules, may be set to any value, but only numbers will be useful: 0 to disable random ticks, higher numbers for more random ticks (default value is 3).
  • reducedDebugInfo - Whether the debug screen shows all or reduced infomation
  • sendCommandFeedback - Whether the feedback from commands executed by a player should show up in chat
  • showDeathMessages - Whether a message appears in chat when a player dies
In addition, new game rules may be defined and set (by providing a value) or queried (by not providing a value). For example, gamerule MyNewRule 10 defines a new game rule called MyNewRule and sets its value to 10. Attempting to query a game rule which has not yet been set will cause the command to fail (a change from the previous behaviour of always succeeding).

[edit] give

Gives an item to a player.

[edit]give
Restrictions

Operator

First introduced

1.3.1 (12w16a)

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 valid item data for the given item. If not specified, defaults to 0.
dataTag (optional)
Specifies the data tag of the given item(s). Must be a valid data tag for the given item.
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 0Verify 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

[edit] help

Provides help for commands.

[edit]help
Restrictions

None

First introduced

Classic 0.0.15a 03

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

[edit] kick

Kicks a player off a server.

[edit]kick
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Classic 0.0.15a_03

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

[edit] kill

Kills a player.

[edit]kill
Restrictions

Operator

First introduced

1.3.1 (12w16a)

Syntax
kill [player|entity]
Description
Inflicts 1000 (Heart.svg × 500) void damage to the target, killing the target instantly even if in Creative mode (a high-level Resistance effect cannot protect the player either). The text "Ouch! That looks like it hurt." will be displayed after executing. Useful when lost, stuck, or to restore health and hunger (assuming you can get your items back easily or the keepInventory gamerule is set to "true"). If player|entity is not specified, the player running the command will be killed.
The player|entity argument will be added in 1.8 and is currently available only in the snapshots.
Success Conditions
player|entity is not optional in command blocks.

[edit] list

Lists players on the server.

[edit]list
Restrictions

Multiplayer
Operator

First introduced

Classic 0.0.15a_03

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.

[edit] me

Displays a message about yourself.

[edit]me
Restrictions

None

First introduced

Classic 0.0.15a_03

Syntax
me <action …>
Description
Sends a narrative message to the other players in the form of "* Yourname action" (e.g., "* Notch sneezes." or "* Notch 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.

[edit] msg

Alternate syntax for /tell.

[edit] op

Grants operator status to a player.

[edit]op
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Classic 0.0.15a_03

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

[edit] pardon

Removes player from server blacklist.

[edit]pardon
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Classic 0.0.15a_03

Syntax
pardon <name>
Description
Removes player name from the blacklist, allowing them to connect again.
Success Conditions
Always succeeds.

[edit] pardon-ip

Removes IP address from server blacklist.

[edit]pardon-ip
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Classic 0.0.15a_03

Syntax
pardon-ip <address>
Description
Removes IP address from the IP blacklist, allowing players from that IP address to connect to the server.
Success Conditions
address must be a valid IP.

[edit] particle

Creates particles.

[edit]particle
Restrictions

Operator

First introduced

1.8 (14w04a)

Syntax
particle <name> <x> <y> <z> <xd> <yd> <zd> <speed> [count] [force] [player|entity]
Description
Spawns particles in a given area or at a given player/entity.
force may be either normal or force.
  • normal - Default. Particles are seen 16 or less blocks away from <x> <y> <z>
  • force - Particles are seen greater than 16 blocks away from <x> <y> <z>
Success Conditions
name must be a valid particle name. x and z must be within the range -30,000,000 to 30,000,000 (inclusive). player|entity is not optional in command blocks.

[edit] playsound

Plays a sound.

[edit]playsound
Restrictions

Operator

First introduced

1.6.1 (1.6.1pre)

Syntax
playsound <sound> <player> [x] [y] [z] [volume] [pitch] [minimumVolume]
Description
Plays the selected sound to the selected player. The value of sound is any event defined in sounds.json (for example, mob.pig.say). Note that 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). If an event contains multiple sounds, this command will select randomly between them (chances are modified by each sound's "weight" property), just as the game normally would. For example, "mob.pig.say" will play one of several pig sounds at random, because the event has multiple sounds associated with it.
The coordinates x, y, and z are the coordinates to play the sound from. If prefixed with "~", they will be relative to the player's current location. Note that "~" is shorthand for "~0", and thus "~ ~ ~" can be used as a substitute for the player's current location.
The volume argument controls the distance from which a sound may be heard. At values less than 1.0, the sound will be quieter and have a smaller sphere within which it may be heard. At 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.
The minimumVolume argument controls the volume of the sound for players outside its normal audible sphere. If the player is outside the normal sphere, the sound will instead be centered some short distance (<4 blocks) from the player, and minimumVolume will determine its volume.
The pitch argument alters both the pitch and the duration of the sound (which means that it's actually changing its speed).
Success Conditions
player must be online, volume must be at least 0.0, pitch must be between 0.0 and 2.0 (inclusive), minimumVolume must be between 0.0 and 1.0 (inclusive), and the player must be able to hear the sound from where it is played.

[edit] publish

Opens single-player world to the local network.

[edit]publish
Restrictions

Operator
No command blocks

First introduced

1.3.1 (12w24a)

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.

[edit] replaceitem

These commands replace items in blocks or entities.

[edit]replaceitem
Restrictions

Operator

First introduced

1.8 (14w26a)

[edit] replaceitem block

Replace items in a block.

Syntax
replaceitem block <x> <y> <z> <slot> <item> [amount] [data] [dataTag]
Description
Replaces an item in a certain slot of a container block with another item.
The slot argument must be slot.container.* (where * is replaced with a number for the correct inventory slot).
Success Conditions
The block must be a container block and the slot and item arguments must be correct.

[edit] replaceitem entity

Replace items in an entity's inventory.

Syntax
replaceitem entity <selector> <slot> <item> [amount] [data] [dataTag]
Description
Replaces an item in a certain slot of an entity (player or mob) with another item.
The slot argument must be one of (where * is replaced with a number for the correct inventory slot):
  • slot.armor.feet|legs|chest|head
  • slot.enderchest.*
  • slot.horse.armor|chest.*|saddle
  • slot.hotbar.*
  • slot.inventory.*
  • slot.villager.*
  • slot.weapon
slot.equipment.* is not currently a valid argument, but mob equipment can be replaced with slot.armor.* or slot.weapon (listed above).
Success Conditions
The player must be online and the slot and item arguments must be correct.

[edit] save

These commands manage server saves.

[edit]save
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Classic 0.0.15a_03

[edit] save-all

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.

[edit] save-off

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.

[edit] save-on

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.

[edit] say

Says a message to multiple players.

[edit]say
Restrictions

Operator

First introduced

Classic 0.0.16a_01

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.

[edit] scoreboard

These commands manage scoreboard objectives, players, and teams.

[edit]scoreboard
Restrictions

Operator

First introduced

1.5 (13w04a)

Syntax
scoreboard <objectives|players|teams>
Description
See Scoreboard for more information. Scoreboard-specific commands.
Success Conditions
Main Article

[edit] seed

Displays the world seed.

[edit]seed
Restrictions

Operator

First introduced

1.3.1 (12w21a)

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).

[edit] setblock

Changes a block to another block.

[edit]setblock
Restrictions

Operator

First introduced

1.7.2 (13w37a)

Syntax
setblock <x> <y> <z> <TileName> [dataValue] [oldBlockHandling] [dataTag]
Description
Places the block in the x, y and z coordinates specified.
Success Conditions
TileName must exist, dataValue must exist if specified, oldBlockHandling must be either replace, keep or destroy if specified and dataTag must evaluate if specified.

[edit] setidletimeout

Sets the time before idle players are kicked fromthe server.

[edit]setidletimeout
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Classic 0.0.15a_03

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.

[edit] setworldspawn

Sets the spawn chunks for a world.

[edit]setworldspawn
Restrictions

Operator

First introduced

1.7.2 (13w43a)

Syntax
setworldspawn
setworldspawn <x> <y> <z>
Description
Sets the world's spawn to the specified coordinates. The worldspawn is where you first spawn and where you respawn if you die and your bed is missing or obstructed. If no coordinates are specified, the world spawn will be set to the executor's current location. Note that a 10 chunk (160 block) radius around the worldspawn is kept loaded at all times. However this only applies if the chunks are already loaded when it is set. Setting it to a place where no player is will NOT cause the area to load. Also compasses (which in minecraft point to the worldspawn rather than north) will not update to the change until you reload the world.
Success Conditions
x, y, and z must be within the range -30,000,000 to 30,000,000 (inclusive). x, y, and z are not optional in command blocks.

[edit] spawnpoint

Sets the spawn point for a player.

[edit]spawnpoint
Restrictions

Operator

First introduced

1.4.2 (12w32a)

Syntax
spawnpoint
spawnpoint <player>
spawnpoint <player> <x> <y> <z>
Description
Sets the spawnpoint of that player to that position, or to the current position if x y and z are not specified. player is optional if x y z are not specified; will set the spawnpoint of the user to their current location. NOTE: Spawnpoint coordinates must be specified in integers. No decimals.
Sleeping in a bed will also set a spawn point where the bed is, but you can only sleep in beds at night or when there is a thunderstorm.
Success Conditions
player must be online, and x, y, and z must be within the range -30,000,000 to 30,000,000 (inclusive).

[edit] spreadplayers

Teleports players to random locations within an area.

[edit]spreadplayers
Restrictions

Operator

First introduced

1.6.1 (13w23a)

Syntax
spreadplayers <x> <z> <spreadDistance> <maxRange> <respectTeams> <player …>
Description
This command allows players to spread out over a long or short distance.
x and z mark the center of the area across which players are to be spread.
spreadDistance is the rough minimum distance players will be spread apart.
maxRange is the maximum distance from x, z where players will be put. Note that this distance is not a circular radius; it represents the maximum distance on either coordinate (thus forming a box ranging from x-maxRange to x+maxRange and z-maxRange to z+maxRange).
respectTeams may be true or false, and represents whether players should be moved individually or teams should be kept together.
player is the list of players to spread. Names are separated by spaces.
Success Conditions
x and z must be within the range -30,000,000 to 30,000,000 (exclusive), spreadDistance must be at least 0, maxRange must be at least 1.0 greater than spreadDistance, and there must not be too many players to fit within the area. If maxRange is larger than 30,000,000, the command can fail with even one player if it attempts to place them outside the world boundary). Players do not spread to lava.

[edit] stats

These commands manage CommandStats statistics.

[edit]stats
Restrictions

None

First introduced

1.8 (14w28a)

[edit] stats block clear

Clears the CommandStats values of a block.

Syntax
stats block [x] [y] [z] clear <stat>
Description
Clears the specified stat of a block. stat must be one of the following:
  • SuccessCount
  • AffectedBlocks
  • AffectedEntities
  • AffectedItems
  • QueryResult
Success Conditions
Unknown

[edit] stats block set

Sets the CommandStats values of a block.

Syntax
stats block [x] [y] [z] set <stat> <selector> <objective>
Description
Sets a stat of a specified block to update objective of entity selector. stat must be one of the following:
  • SuccessCount
  • AffectedBlocks
  • AffectedEntities
  • AffectedItems
  • QueryResult
Success Conditions
Unknown

[edit] stats entity clear

Clears the CommandStats values of an entity.

Syntax
stats entity <selector> clear <stat>
Description
Clears the specified stat of entity selector. stat must be one of the following:
  • SuccessCount
  • AffectedBlocks
  • AffectedEntities
  • AffectedItems
  • QueryResult
Success Conditions
Unknown

[edit] stats entity set

Sets the CommandStats values of an entity.

Syntax
stats entity <selector1> set <stat> <selector2> <objective>
Description
Sets a stat of entity selector1 to update objective of entity selector2. stat must be one of the following:
  • SuccessCount
  • AffectedBlocks
  • AffectedEntities
  • AffectedItems
  • QueryResult
Success Conditions
Unknown

[edit] stop

Stops a server.

[edit]stop
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Classic 0.0.15a_03

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

[edit] summon

Summons an entity.

[edit]summon
Restrictions

Operator

First introduced

1.7.2 (13w36a)

Syntax
summon <EntityName> [x] [y] [z] [dataTag]
Description
Spawns an entity. For example, to create a charged creeper named Powered Creeper at the player's current location: /summon Creeper ~ ~ ~ {powered:1,CustomName:Powered Creeper}.
EntityName may be LightningBolt to spawn a lightning bolt. The option to summon a lightning bolt will be added in 1.8 and is currently available only in the snapshots.
Success Conditions
x and z must fall within the range -30,000,000 to 30,000,000 (inclusive), and y must be at least 0. If coordinates aren't specified the entity will spawn at the player's location (or inside a command block if the command was executed by one).

[edit] tell

Sends a private message to a player.

[edit]tell
Restrictions

None

First introduced

Classic 0.0.15a_03

Syntax
tell <player> <private message …>
msg <player> <private message …>
w <player> <private message …>
Description
Used to send a private message to a player on the server. Very useful on servers if you need to ask/tell something from/to another player without other players seeing. If a multi-person target selector (e.g., @a) is used in private message, 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 private message, this command will only output once - however, a selector for player can send a message to multiple people.
Success Conditions
All target selectors (e.g., @p) in private message must evaluate, and player must be online.

[edit] tellraw

Sends a JSON message to players.

[edit]tellraw
Restrictions

Operator

First introduced

1.7.2 (13w37a)

Syntax
tellraw <player> <raw json message>
Description
Sends a JSON message to specified player(s), allowing formatting and clickable actions in chat text. Color defaults to white and all formatting (bold, italic, etc.) defaults to false.
Success Conditions
player must be online, and the message text must be correctly coded in JSON.

[edit] testfor

Tests for the existence of a player with specific data tags.

[edit]testfor
Restrictions

Operator

First introduced

1.5 (13w03a)

Syntax
testfor <player> [dataTag]
Description
Used to test whether the given player (or entity, by the @e target selector) could be located, and whether it has all tags specified by dataTag. A redstone comparator as output from a command block with this command will indicate the number of players/entities matched by it. For example, "testfor @a[r=3]" will output the number of players within 3 meters of the command block, and added in 14w20a, "testfor @e[type=Arrow,r=3] {inGround:1b}" will output the number of arrows stuck in a block within 3 meters.
Success Conditions
player and dataTag must be valid and match some entity if specified.

[edit] testforblock

Tests whether a certain block is in a specific location.

[edit]testforblock
Restrictions

Operator

First introduced

1.7.2 (13w37a)

Syntax
testforblock <x> <y> <z> <TileName> [dataValue] [dataTag]
Description
Used to test whether a particular block is in the x, y and z coordinates specified. Datatags will not work unless a special syntax is used to specify what type of NBT tag is used (s for Short, b for Byte, l for Long, f for Float and d for Double). Also all relevant tags must be included even if they are unused (e.g.: Chest contents must include Slot, id, Damage, and Count.)
Success Conditions
TileName must exist, dataValue must exist if specified, and dataTag must evaluate if specified.

[edit] testforblocks

Tests whether the blocks in two regions match.

[edit]testforblocks
Restrictions

Operator

First introduced

1.8 (14w07a)

Syntax
testforblocks <x1> <y1> <z1> <x2> <y2> <z2> <x> <y> <z> [mode]
Description
Compares the blocks at two locations in cuboid regions. (x1, y1, z1) and (x2, y2, z2) specifies the lowest and highest coordinate corners of the source region (the block pattern to check for), and (x, y, z) specifies the lowest coordinate corner of the destination region (the region to be checked).
mode is masked (air blocks in the source region will match any block in the destination region) or all (all blocks must match exactly, even air).
Success Conditions
x1, z1, x2, z2, x, and z must fall within the range -29,999,984 to 29,999,984 (inclusive). y must be 0 to 189, and y2 must be 0 to 187.

[edit] time

These commands manage the world time.

[edit]time
Restrictions

Operator

First introduced

1.3.1 (12w16a)

[edit] time add

Increments or decrements the world time.

Syntax
time add <value>
Description
Increments the world time; see time set below for value details.
Success Conditions
value must be 0 or positive. The daytime wraps, and the moon's phase advances; adding 24000 will advance the moon's phase by one day.

[edit] time query

Displays the current time.

Syntax
time query <value>
Description
Returns the current time in the chat.

value must be daytime (returns the time of the current day, up to 24000) or gametime (returns the time of the world).

Success Conditions
n/a

[edit] time set

Sets the world time.

Syntax
time set <value>
Description
Sets the world time. value where each 24000 is equal to 1 day. 0 is dawn on day zero, 6000 midday on day zero, 12000 dusk on day zero and 18000 midnight on day zero. value can be greater than 24000; in this case, the time of day wraps around, but the moon's phase is advanced. However, setting the time "backward" (earlier than the current time) does not change the moon. "time set day" sets the time to 1000, and "time set night" sets the time to 13000.
Success Conditions
value must be 0 or positive, or day or night. Using day or night rewinds time back to day zero.

[edit] title

These commands manage screen titles.

[edit]title
Restrictions

None

First introduced

1.8 (14w20a)

[edit] title clear

Clears a screen title from players.

Syntax
title <player> clear
Description
Removes title from player.
Success Conditions
player must be a valid online player.

[edit] title reset

Resets defaults for screen titles for players.

Syntax
title <player> reset
Description
Resets subtitle, fadeIn time, stay time, and fadeOut time for player.
Success Conditions
player must be a valid online player.

[edit] title subtitle

Sets the subtitle for a future screen title.

Syntax
title <player> subtitle <raw json title>
Description
Sets the subtitle text for player. This is only displayed if a title is on the player's screen at the same time (can be empty).
Success Conditions
player must be a valid online player. raw json title must be a single word of text (not delimited by curly brackets) or a valid json specification.

[edit] title times

Sets the display times for a future screen title.

Syntax
title <player> times <fadeIn> <stay> <fadeOut>
Description
Sets the time in game ticks for title (and optional subtitle) to fade in, persist, and fade out, for player.
Success Conditions
player must be a valid online player.

[edit] title title

Sets the title text for a screen title and shows it.

Syntax
title <player> title <raw json title>
Description
Sets the title text for player and shows the title (optionally, with prespecified subtitle). Titles are displayed in the middle of your screen.
Success Conditions
player must be a valid online player. raw json title must be a single word of text (not delimited by curly brackets) or a valid json specification.

[edit] toggledownfall

Toggles the weather.

[edit]toggledownfall
Restrictions

Operator

First introduced

1.3.1 (12w16a)

Syntax
toggledownfall
Description
Toggles rain and snow.
Success Conditions
Always succeeds.

[edit] tp

Teleport players.

[edit]tp
Restrictions

Operator

Syntax
tp [target player] <destination player>
tp [target player] <x> <y> <z>
Arguments
target player (optional)
Specifies the player to be teleported. If specified, must be either a player name or a target selector. If not specified, defaults to the command user. Not optional in command blocks.
destination player
Specifies the player to teleport the target player to. Must be either a player name or a target selector.
x y z
Specifies the coordinates to teleport the target player to. Specifying relative distances with tilde notation will teleport the target player a distance relative to their current position. Absolute coordinate and relative distances can be used for each coordinate separately. x and z must fall within the range -30,000,000 to 30,000,000 (exclusive), and y must be at least 0.
Result
Fails if the arguments are not specified correctly, if target player fails to resolve to one or more online players, or if destination player fail to resolve to a single online player.
On success, teleports the target player to the specified destination.
Examples
To teleport yourself to Notch: tp Notch
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
Future
The target selector @e can be used for both the target player and destination player, allowing the use of mobs and items as targets and/or destinations.
Additional arguments will also be available when teleporting to a coordinate allowing the target's rotation to be specified:
tp [target player] <x> <y> <z> [<y-rot> <x-rot>]
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 player'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 player's previous rotation.
For example, to rotate the nearest player 10 degrees to the right without changing their position: tp @p ~ ~ ~ ~10 ~

[edit] trigger

Sets a trigger to be activated in a tellraw message.

[edit]trigger
Restrictions

None

First introduced

1.8 (14w06a)

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.

[edit] w

Alternate syntax for /tell.

[edit] weather

Sets the weather.

[edit]weather
Restrictions

Operator

First introduced

1.4.2 (12w32a)

Syntax
weather <clear|rain|thunder> [duration in seconds]
Description
Changes the weather for the specified duration.
Success Conditions
duration in seconds must be at least 1, and cannot be greater than 1,000,000, and a valid weather condition must be provided.

[edit] whitelist

Adds or removes a player from a server whitelist.

[edit]whitelist
Restrictions

Multiplayer
Operator
No command blocks

First introduced

Classic 0.0.15a_03

Syntax
whitelist <add|remove> <player>
Description
Adds or removes player from the whitelist.
Success Conditions
Always succeeds.

[edit] whitelist list

Displays the server whitelist.

Syntax
whitelist list
Description
Displays all players in the whitelist.
Success Conditions
Always succeeds.

[edit] whitelist on|off

Turns the server whitelist on or off.

Syntax
whitelist <on|off>
Description
Enables/disables the server's use of a whitelist. Note: Server ops will always be able to connect when the whitelist is active, even if their names do not appear in the whitelist.
Success Conditions
Always succeeds.

[edit] whitelist reload

Reloads the server whitelist.

Syntax
whitelist reload
Description
Reloads the list of playernames 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).
Success Conditions
Always succeeds.

[edit] worldborder

These commands manage the world border.

[edit]worldborder
Restrictions

Operator

First introduced

1.8 (14w17a)

[edit] worldborder add

Increases or decreases the worldborder diameter.

Syntax
worldborder add <sizeInBlocks> [timeInSeconds]
Description
Adds blocks to the current size of the world border. Can use negative (-) numbers to subtract the size of the border.
Success Conditions
Always succeeds even if the worldborder isn't set.

[edit] worldborder center

Sets the center of the world border.

Syntax
worldborder center <x> <z>
Description
Sets the center of the world border.
Success Conditions
x and z must fall within the range -30,000,000 to 30,000,000 (exclusive).

[edit] worldborder damage amount

Sets the damage inflicted outside the world border.

Syntax
worldborder damage amount <damagePerBlock>
Description
Sets the amount of damage inflicted per second per block past the world border buffer (defaults to 0.2). 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).
Success Conditions
damagePerBlock must be at least 0.0.

[edit] worldborder damage buffer

Sets a buffer distance outside the world border before damage begins.

Syntax
worldborder damage buffer <sizeInBlocks>
Description
Sets the buffer distance outside the world border before damage begins to be inflicted (defaults to 5.0).
Success Conditions
sizeInBlocks must be at least 0.0.

[edit] worldborder get

Displays the world border diameter.

Syntax
worldborder get
Description
Returns the current diameter of the world border.
Success Conditions
Always succeeds.

[edit] worldborder set

Sets the world border diameter.

Syntax
worldborder set <sizeInBlocks> [timeInSeconds]
Description
Sets the diameter of the world border. sizeInBlocks is the new diameter. timeInSeconds is the number of seconds it should take for the border to move from its previous location to the new location. If timeInSeconds is not specified, the diameter changes immediately.
Success Conditions
sizeInBlocks must fall within the range 1 to 60,000,000 (inclusive).

[edit] worldborder warning distance

Sets the world border warning distance.

Syntax
worldborder warning distance <blocks>
Description
Sets the distance inside the world border where visual warning of world border proximity begins (defaults to 5).
Success Conditions
blocks must be at least 0.

[edit] worldborder warning time

Sets the world border warning time.

Syntax
worldborder warning time <seconds>
Description
Sets the time before a moving world border intersects the player when visual warning of the world border starts (defaults to 15). 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.
Success Conditions
seconds must be at least 0.

[edit] xp

Adds experience to a player.

[edit]xp
Restrictions

Operator

First introduced

1.3.1 (12w16a)

Syntax
xp <amount> [player]
Description
Gives the specified user the given number of orbs. Maximum is 2,147,483,647 per command. Negative amounts may not be used to remove experience points.
Success Conditions
amount can be at most 2,147,483,647. player is not optional in command blocks, and player must be online.

[edit] xp L

Increases or decreases a player's experience level.

Syntax
xp <amount>L [player]
Description
Gives player the amount number of experience levels. Maximum is 2,147,483,647 — if a player is given levels pushing them past this limit, they get reset to 0. Negative amounts may be used to remove experience levels.
Success Conditions
amount must be between -2,147,483,648 and 2,147,483,647, inclusive. player is not optional in command blocks, and player must be online.

[edit] Video

[edit] History

Classic
0.0.15a_03 Added /ban, /ban-ip, /banlist, /broadcast, /deop, /kick, /list, /op, /pardon, /pardon-ip, /save-all, /save-on, /save-off, /stop, and /whitelist.
0.0.16a_01 Changed /broadcast to /say.
0.0.17a Added /setspawn.
0.0.20 Added /solid.
Official release
1.3.1 12w16a Added cheats mode and /gamemode, /give, /kill, /time, /toggledownfall, and /xp.
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 /clear can now be used to remove specific blocks/items.
12w41a The limit for /xp is now 2,147,483,647 instead of 5,000.
1.4.4 1.4.4pre 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.6pre Added clear argument to /effect.
1.6.1pre 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.
Upcoming
1.8 14w02a Added /blockdata.
Added @e selector.
Added optional player/entity argument to /kill.
Added additional arguments to /clear and /testfor.
/testfor is no longer exclusive to command blocks.
Added insertion tag to /tellraw.
14w03a Added rotation arguments to /tp.
Added dx, dy, and dz to 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 the force option to /clone.
14w17a Added /worldborder.
Added gamerule randomTickSpeed.
14w19a Added /worldborder damage and /worldborder warning.
14w20a Added /title.
Added selector argument to /tellraw.
Added the 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.

[edit] Issues

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

[edit] See also