Commands

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

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 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 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 ( -> "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

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:

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


 * Target the nearest player.
 * Target the nearest player.


 * Target a random player.
 * Target a random player.


 * Target all players.
 * 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 but has not yet been released in a full version:


 * Target all entities (including players).
 * Target all entities (including players).

Target selector arguments
After using a target selector, you can optionally use arguments to modify the set of targets selected. When used with  or , arguments narrow down the number of targets from the full list to a specific few. When used with  or , 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:



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


 * Selecting targets by coordinate




 * Selects only targets at that exact position (ignoring fractions).


 * Selecting targets by radius




 * Selects only targets within specified radius/i from the position where the command was executed.  specifies the maximum radius that targets can be from the coordinate, and   specifies the minimum radius. It is possible to use either without the other (  to specify targets within a certain radius, and   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,,  ,  , and  . Thus, the following two commands are identical:




 * Selecting targets by game mode




 * Selects only targets with the specified game mode. Permitted value for M are:


 * : all game modes
 * : creative mode
 * : survival mode
 * : adventure mode


 * In the, M may also be  for spectator mode.


 * Selecting targets by count




 * Selects only the specified number of targets. When used with  or , 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,   will return the three farthest targets). When used without position selection, targets are returned in the order of creation (for example,   will select the first target created and   will select the last three targets created).


 * Selecting targets by experience level




 * Selects only targets with no more than L experience levels.




 * Selects only targets with no less than LM experience levels.


 * Selecting targets by score




 * Selects only targets with a score in objective name of no more than SCORE.




 * Selects only targets with a score in objective name of no less than SCOREMIN.


 * Selecting targets by team




 * Selects only targets on team TEAM.




 * Selects only targets not on team TEAM.


 * Selecting targets by name




 * Selects only targets named NAME.




 * Selects only targets not named NAME.

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


 * Selecting targets by volume




 * 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,  , and   arguments, that will be used instead of the position of the command's execution for the lower northwestern corner ( ,  , and   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 radiuses of the volume's lower northwestern 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).




 * Selects only targets with a maximum vertical rotation of RX.




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




 * Selects only targets with a maximum horizontal rotation of RY.




 * Selects only targets with a minimum horizontal rotation of RYM.


 * Selecting targets by type


 * Primarily only used with the  variable (because all players are  ). "Entity types" are the entity IDs used to identify different types of entities internally (see chunk format).




 * Selects only targets of the specific entity type.




 * Selects only targets not of the specific entity type.

Data tags
NBT tags can be specified for items and entities created with the, 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. 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 ). 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.
 * 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   appended after the number. Examples:  ;  ; &
 * List (or 'Array') is multiple, comma separated values wrapped with square brackets. The containing values do not need to be of the same type.
 * Boolean can either be  or , but using Numbers works, too. When using numbers, 0 is false, everything else is 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: 


 * null This is a placeholder an empty value. Do not put quotes.

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:
 * Blocks
 * Entities
 * Mobs
 * Projectiles (arrows, fireballs, thrown potions, etc.)
 * Items (items on the ground)
 * Vehicles (boats, minecarts, etc.)
 * Dynamic Tiles (primed TNT, falling sand/gravel)
 * Other Entities (firework rockets, paintings, and item frames)
 * Tile Entities (chests, furnaces, command blocks, mob spawners, signs, etc.)
 * Player
 * Items (items in player's inventory or containers)

For a complete list of identifiers, see:
 * blocks
 * items
 * entities
 * enchantments
 * status/potion effects
 * attributes

Raw JSON Text
The 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 "" is a JSON Object which supports the following (mostly optional) elements:
 * The base chat component Object
 * : 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.
 * : 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.
 * : 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.
 * : Boolean (true/false) - whether to render text in bold. Defaults to false.
 * : Boolean (true/false) - whether to render text underlined. Defaults to false.
 * : Boolean (true/false) - whether to render text in italics. Defaults to false.
 * : Boolean (true/false) - whether to render text with a strikethrough. Defaults to false.
 * : Boolean (true/false) - whether to render text obfuscated. Defaults to false.
 * : 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.
 * : Allows for events to occur when the player clicks on text.
 * : 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).
 * : The URL, chat, or command used by the specified action. Note that commands must be prefixed with the usual "/" slash.
 * : Allows for a tooltip to be displayed when the player hovers their mouse over text.
 * : 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).
 * : 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 command).
 * "show_achievement": The achievement or statistic's name. This uses the same format as achievement and statistic Scoreboard objective criteria and the 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).
 * : 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.
 * : 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).
 * : 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.
 * : 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,  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.
 * : The internal name of the objective to display the player's score in.
 * : Optional. If present, this value is used regardless of what the score would have been.
 * : 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,  is equivalent to. This shorthand substitution is valid anywhere a raw text object is required (including the base  argument of, the elements of the extra list, and the value of a "show_text" hover_event).

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

List of commands

 * Syntax


 * {| class="wikitable" style="text-align:center"

! If you see… !! Then Pick one of the options shown.
 *  || 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
 * italics || Replace this with an appropriate value.
 * plain text || Enter this literally, exactly as shown.
 * x | y
 * x | y
 * x | y

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:, , , and.


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


 * Multiplayer: The command is only available on a multiplayer server. The following commands are restricted to multiplayer servers:, , , , , , , , , , , , , ,.
 * No multiplayer commands permit target selectors in arguments and, except for, 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.

?
Alternate syntax for.

achievement
Gives a player an achievement or increases a statistic.


 * Syntax




 * Arguments


 * stat_name


 * Must be either:
 * , where achievement_name is a valid achievement identifier
 * , 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:


 * To grant the "Taking Inventory" achievement to Notch:


 * To increase the "Mob Kills" statistic by 1 for the nearest player:


 * See also


 * Commands to modify player:
 * — give player a status effect
 * — set player's spawn location
 * — modify player's CommandStats
 * — modify player's experience or level

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.

ban
Adds player to banlist.


 * Syntax




 * 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
Adds IP address to banlist.


 * Syntax




 * 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
Displays banlist.


 * Syntax




 * Result


 * Always succeeds. Displays banned IP addresses or banned players.

blockdata
Modifies the data tag of a block.


 * Syntax




 * 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


 * — replaces items in a block's inventory
 * – places a new block at a position
 * — sets a block's CommandStats
 * — checks if a specifc block is at a specific position

clear
Clears items from players.


 * Syntax




 * Description


 * Clears the inventory of  (defaults to the executing player if unspecified) of the specified , with the specified  . Does not remove more than   items. If no optional tags are specified, the entire inventory is cleared.


 * The  and   arguments will be added in 1.8 and are currently available only in the snapshots.


 * Success Conditions


 * At least zero item(s) must be removed, and  must be online. Can output a comparator signal if successfully cleared item(s).   can be set to -1 to clear regardless of Damage value, and   can be set to -1 to clear all of the selected item.

clone
Clones blocks from one area to another.


 * Syntax




 * Description


 * Clones the given area. The destination is (x, y, z), where the blocks are placed going into positive coordinate values.


 * can be:


 * replace - (the default), which copies all blocks.
 * masked - which copies all non-air blocks.
 * filtered - which only clones the specified blocks.


 * can be:


 * move - where it replaces the cloned blocks with air (on filtered you must include what blocks to be filtered out).
 * force - which makes the command execute even if the area being cloned overlaps with the area blocks being cloned to (on filtered you must include what blocks to be filtered out).
 * normal - (on filtered you must include what blocks to be filtered out).


 * Success Conditions


 * The area being cloned and the area where the cloned blocks are going must both be rendered, must not overlap, and must be within the 32768 block limit (including air blocks)

debug
Starts or stops a debugging session.


 * Syntax




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

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


 * Syntax




 * Description


 * 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; i.e., if the default game mode is creative, new players will start in creative. This command cannot enable or disable Hardcore mode.


 * Success Conditions


 * mode must be a valid game mode:,  ,  , or  . The game modes can be abbreviated to "s/c/a/sp" or "0/1/2/3" respectively.

deop
Revoke op status from a player.


 * Syntax




 * Description


 * Revokes a player's operator status.


 * Success Conditions


 * Always succeeds.

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


 * Syntax




 * Description


 * Changes the difficulty for as long as the server is running. If the server is restarted, the difficulty will go back to whatever difficulty is set in server.properties.


 * Success Conditions


 * must be a valid difficulty:,  ,  , or  . The difficulties can be abbreviated to "p/e/n/h" or "0/1/2/3" respectively.

effect
Adds status effect to players.


 * Syntax




 * Description


 * Gives the targeted player (or entity, via the @e target selector) the specified effect for the specified time (default is 30 seconds). Effects have a limit of 1,000,000 seconds, and the  field has a limit of 255. Effect id's can be found on the potion effects page. Setting   to 0 clears this effect. If you put the amplifier to a number of a variably high value, it will not give the desired amplifier. Setting   to true hides effect particles, if value not given, defaults to false. As of 14w28a you can now use the effect name instead of the id. Example (/effect @p minecraft:haste 60 1 True) this will give the nearest player Haste II  for 1 minute (60 seconds).


 * Success Conditions


 * If clearing an effect, the player must have this effect.  must be a valid effect. player must be online.

effect clear
Clears status effects from players.


 * Syntax




 * Description


 * Clears all effects on  (or entity, via the @e target selector).


 * Success Conditions


 * At least one effect must be removed, and  must be online.

enchant
Adds an enchantment to a player item.


 * Syntax




 * Description


 * Enchants the item that the player is currently holding, according to enchantment ID. Note that this works within the normal limitations of enchanting items. Enchantments can only be applied to items which can normally receive that specific enchantment. Enchantment levels can not be above the normal highest achievable for the selected enchantment. Conflicting or overpowering enchantment combinations usually prevented are also prevented with this command. As of 14w28a you can now use the enchant name instead of the id. Example (/enchant @a minecraft:infinity) this will give all players an infinity enchantment on their bow if its selected.


 * Success Conditions


 * The enchantment ID(or name) must be valid, the level must be valid for this enchantment (unless the held item is also invalid), the held item must be able to accept this enchantment, the held item cannot have conflicting enchantments, and player must be online.

execute
Executes a command in another context.


 * Syntax




 * Description


 * Runs  as though it were executed by , and as though   were located at x, y, z. The command will be run as though the entity has operator-level permission.


 * Success Conditions


 * entity must resolve to one or more valid entities (including players, who must be online if specified by name). x and z must be within the range -30,000,000 to 30,000,000 (inclusive). command must execute successfully.

execute detect
Executes a command if a certain block is detected.


 * Syntax




 * Description


 * Runs  as though it were executed by , and as though   were located at x, y, z. It will only run   if the specified block is located at x2, y2, z2, starting from x, y, z for relative coordinates. The command will be run as though the entity has operator-level permission.


 * The  command will be added in 1.8 and is currently available only in the snapshots.


 * Success Conditions


 * entity must resolve to one or more valid entities (including players, who must be online if specified by name). x and z must be within the range -30,000,000 to 30,000,000 (inclusive). The specified block must be found at x2, y2, z2. command must execute successfully.  can be set to -1 to check regardless of Damage valuea.

fill
Fills an area with a block.


 * Syntax




 * Description


 * Fills the given area with a block specified by,  , and  .   mode is either  ,  ,  , or.
 * replace - Destroys any blocks within the target location and replaces them with "TileName", without dropping item entities.
 * destroy - Destroys any blocks within the target location, dropping them as item entities, and replacing them with "TileName".
 * keep - Only replaces air blocks found in the fill area with "TileName".
 * hollow - Wraps only the outer layer of the fill area, creating a square box of "TileName", and replacing all blocks inside of the box area with air. Containers inside of the box will drop their contents, but not their block.
 * outline - Wraps only the outer layer of the fill area, creating a square box of "TileName". (Leaves all blocks leftover inside the box area alone and doesn't destroy them)


 * Success Conditions


 * A starting point and an end point must be input followed by a block. Your feet (y-value), will be the point where blocks will begin to fill. Chunks must be loaded and can only fill within a 32768 block limit (including air blocks)

fill replace
Replaces certain blocks in an area with other blocks.


 * Syntax




 * Description


 * Replaces all blocks matching  and   in a given area with   and  . If   and   are not given, any block will be replaced. Note that the replace operation does not support a   argument if   is given (use above syntax instead to replace any block and have dataTag support).


 * The  command will be added in 1.8 and is currently available only in the snapshots.


 * Success Conditions


 * A starting point and an end point must be input followed by a block. Your feet (y-value), will be the point where blocks will begin to fill. Chunks must be loaded and can only fill within a 32768 block limit (including air blocks)

gamemode
Sets a player's gamemode.


 * Syntax




 * Description


 * Changes the game mode for . If no   is given, it will set your own gamemode.


 * Success Conditions


 * must be a valid game mode:,  ,  , or  . The game modes can be abbreviated to "s/c/a/sp" or "0/1/2/3" respectively.


 * must currently be online.  is not optional for command blocks.

gamerule
Sets a gamerule value.


 * Syntax




 * Description


 * Sets the value of gamerule . If   is not given, displays the current status of.


 * Available predefined gamerules are:
 * 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 or zombies, skeletons, and Zombie Pigmen can pick up items
 * naturalRegeneration - Whether the player can regenerate health naturally if their hunger is full enough


 * The following predefined gamerules will be added in 1.8 and are currently available only in the snapshots:
 * logAdminCommands - Whether to log admin commands to server log
 * randomTickSpeed - How often a random tick occurs, such as plant growth, leaf decay, etc. Can be 0 to disable random updates
 * 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


 * Valid  for all predefined gamerules are   or , except randomTickSpeed which can be any non-negative integer.


 * In the 1.8 snapshots, new gamerules may be defined and set (by providing a value) or queried (by not providing a value). For example,  defines a new gamerule called   and sets its value to 10. Attempting to query a gamerule which has not yet been set will cause the command to fail.


 * Success Conditions


 * Succeeds in all cases - even absent/invalid  or a property besides   or.

give
Gives an item to a player.


 * Syntax




 * Description


 * Spawns  (defaults to 1) of the item defined by   with the specified   (defaults to 0) at the location of , using   for the "tag" NBT tag. For example typing /give John planks 30 1 {display:{Lore:["Wooden planks"]}} will give a player called John 30 blocks of Spruce Wood Planks with Lore that says "Wooden planks".


 * Success Conditions


 * must be a valid ID or item name,  must be from 0 to 64, and   must be online.

help
Provides help for commands.


 * Syntax




 * Description


 * Shows a list of available commands or further information to the . Note: the multiplayer-only commands are not listed in single-player games, even when open to LAN players.


 * Success Conditions


 * Succeeds if  is valid or no arguments are specified. Technically fails if   is specified, although it displays the usage of the command.

kick
Kicks a player off a server.


 * Syntax




 * Description


 * Forcibly disconnects player from the server, displaying an optional reason to them.


 * Success Conditions


 * player must be online.

kill
Kills a player.


 * Syntax




 * Description


 * Inflicts 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   is not specified, the player running the command will be killed.


 * The  argument will be added in 1.8 and is currently available only in the snapshots.


 * Success Conditions


 * is not optional in command blocks.

list
Lists players on the server.


 * Syntax




 * 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
Displays a message about yourself.


 * Syntax




 * 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., ) is used in , 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  , this command will only output once.


 * Success Conditions


 * All target selectors (e.g., ) in   must evaluate.

msg
Alternate syntax for.

op
Grants operator status to a player.


 * Syntax




 * Description


 * Grants player operator status on the server.


 * Success Conditions


 * Always succeeds.

pardon
Removes player from server blacklist.


 * Syntax




 * Description


 * Removes player name from the blacklist, allowing them to connect again.


 * Success Conditions


 * Always succeeds.

pardon-ip
Removes IP address from server blacklist.


 * Syntax




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

particle
Creates particles.


 * Syntax




 * Description


 * Spawns particles in a given area or at a given player/entity.


 * may be either  or.
 * normal - Default. Particles are seen 16 or less blocks away from   
 * force - Particles are seen greater than 16 blocks away from   


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

playsound
Plays a sound.


 * Syntax




 * 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  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  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   will determine its volume.


 * The  argument alters both the pitch and the duration of the sound (which means that it's actually changing its speed).


 * Success Conditions


 * must be online,  must be at least 0.0,   must be between 0.0 and 2.0 (inclusive),   must be between 0.0 and 1.0 (inclusive), and the player must be able to hear the sound from where it is played.

publish
Opens single-player world to the local network.


 * Syntax




 * 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
These commands replace items in blocks or entities.

replaceitem block
Replace items in a block.


 * Syntax




 * Description


 * Replaces an item in a certain slot of a container block with another item.


 * The  argument must be   (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.

replaceitem entity
Replace items in an entity's inventory.


 * Syntax




 * Description


 * Replaces an item in a certain slot of an entity (player or mob) with another item.


 * The  argument must be one of (where * is replaced with a number for the correct inventory slot):


 * is not currently a valid argument, but mob equipment can be replaced with  or   (listed above).


 * Success Conditions


 * The player must be online and the slot and item arguments must be correct.

save
These commands manage server saves.

save-all
Saves the server to disk.


 * Syntax




 * Description


 * Forces the server to write all pending changes to the world and player data to disk.


 * Success Conditions


 * Always succeeds.

save-off
Disables automatic server saves.


 * Syntax




 * Description


 * Disables the server writing to the world files. All changes will temporarily be queued.


 * Success Conditions


 * Always succeeds.

save-on
Enables automatic server saves.


 * Syntax




 * Description


 * Enables the server writing to the world files. This is the default behavior.


 * Success Conditions


 * Always succeeds.

say
Says a message to multiple players.


 * Syntax




 * Description


 * Broadcasts  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
These commands manage scoreboard objectives, players, and teams.


 * Syntax




 * Description


 * See Scoreboard for more information. Scoreboard-specific commands.


 * Success Conditions


 * Main Article

seed
Displays the world seed.


 * Syntax




 * 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
Changes a block to another block.


 * Syntax




 * Description


 * Places the block in the x, y and z coordinates specified.


 * Success Conditions


 * must exist,  must exist if specified,   must be either ,   or   if specified and   must evaluate if specified.

setidletimeout
Sets the time before idle players are kicked fromthe server.


 * Syntax




 * Description


 * Set the idle kick timer. Any players idle for Minutes until kick will be kicked.


 * Success Conditions


 * Always succeeds.

setworldspawn
Sets the spawn chunks for a world.


 * Syntax




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

spawnpoint
Sets the spawn point for a player.


 * Syntax




 * Description


 * Sets the spawnpoint of that player to that position, or to the current position if x y and z are not specified.  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


 * must be online, and x, y, and z must be within the range -30,000,000 to 30,000,000 (inclusive).

spreadplayers
Teleports players to random locations within an area.


 * Syntax




 * Description


 * This command allows players to spread out over a long or short distance.


 * and  mark the center of the area across which players are to be spread.


 * is the rough minimum distance players will be spread apart.


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


 * may be true or false, and represents whether players should be moved individually or teams should be kept together.


 * 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),  must be at least 0,   must be at least 1.0 greater than , and there must not be too many players to fit within the area. If   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.

stats
These commands manage CommandStats statistics.

stats block clear
Clears the CommandStats values of a block.


 * Syntax




 * Description


 * Clears the specified stat of a block.  must be one of the following:


 * Success Conditions


 * Unknown

stats block set
Sets the CommandStats values of a block.


 * Syntax




 * Description


 * Sets a stat of a specified block to update  of entity  .   must be one of the following:


 * Success Conditions


 * Unknown

stats entity clear
Clears the CommandStats values of an entity.


 * Syntax




 * Description


 * Clears the specified stat of entity .   must be one of the following:


 * Success Conditions


 * Unknown

stats entity set
Sets the CommandStats values of an entity.


 * Syntax




 * Description


 * Sets a stat of entity  to update   of entity  .   must be one of the following:


 * Success Conditions


 * Unknown

stop
Stops a server.


 * Syntax




 * Description


 * Saves all changes to disk, then shuts down the server.


 * Success Conditions


 * Always succeeds.

summon
Summons an entity.


 * Syntax




 * Description


 * Spawns an entity. For example, to create a charged creeper named Powered Creeper at the player's current location:.


 * may be  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).

tell
Sends a private message to a player.


 * Syntax




 * 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., ) 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 , this command will only output once - however, a selector for   can send a message to multiple people.


 * Success Conditions


 * All target selectors (e.g., ) in   must evaluate, and   must be online.

tellraw
Sends a JSON message to players.


 * Syntax




 * 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


 * must be online, and the message text must be correctly coded in JSON.

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


 * Syntax




 * Description


 * Used to test whether the given  (or entity, by the @e target selector) could be located, and whether it has all tags specified by  . 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


 * and  must be valid and match some entity if specified.

testforblock
Tests whether a certain block is in a specific location.


 * Syntax




 * 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


 * must exist,  must exist if specified, and   must evaluate if specified.

testforblocks
Tests whether the blocks in two regions match.


 * Syntax




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


 * is  (air blocks in the source region will match any block in the destination region) or   (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.

time
These commands manage the world time.

time add
Increments or decrements the world time.


 * Syntax




 * Description


 * Increments the world time; see  below for value details.


 * Success Conditions


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

time query
Displays the current time.


 * Syntax




 * Description


 * Returns the current time in the chat.

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


 * Success Conditions


 * n/a

time set
Sets the world time.


 * Syntax




 * Description


 * Sets the world time.  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.   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


 * must be 0 or positive, or  or  . Using day or night rewinds time back to day zero.

title
These commands manage screen titles.

title clear
Clears a screen title from players.


 * Syntax




 * Description


 * Removes title from.


 * Success Conditions


 * must be a valid online player.

title reset
Resets defaults for screen titles for players.


 * Syntax




 * Description


 * Resets subtitle, fadeIn time, stay time, and fadeOut time for.


 * Success Conditions


 * must be a valid online player.

title subtitle
Sets the subtitle for a future screen title.


 * Syntax




 * Description


 * Sets the subtitle text for . This is only displayed if a title is on the player's screen at the same time (can be empty).


 * Success Conditions


 * must be a valid online player.  must be a single word of text (not delimited by curly brackets) or a valid json specification.

title times
Sets the display times for a future screen title.


 * Syntax




 * Description


 * Sets the time in game ticks for title (and optional subtitle) to fade in, persist, and fade out, for.


 * Success Conditions


 * must be a valid online player.

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


 * Syntax




 * Description


 * Sets the title text for  and shows the title (optionally, with prespecified subtitle). Titles are displayed in the middle of your screen.


 * Success Conditions


 * must be a valid online player.  must be a single word of text (not delimited by curly brackets) or a valid json specification.

toggledownfall
Toggles the weather.


 * Syntax




 * Description


 * Toggles rain and snow.


 * Success Conditions


 * Always succeeds.

tp
Teleport players.


 * Syntax




 * 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:


 * To teleport all players to yourself:


 * To teleport yourself to (x,z) = (100,100) but three blocks above your current position:


 * Future


 * The target selector  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:




 * 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:

trigger
Sets a trigger to be activated in a tellraw message.


 * Syntax




 * Description


 * Used together with  to let players activate systems made by operators or mapmakers. The   must be an enabled scoreboard objective of the criteria "trigger". The given   is either added to its existing value, or becomes its new value, depending on whether the second argument is   or  . The value of the objective is only changed for the player who uses the command.


 * Success Conditions


 * must have the "trigger" criteria and the player who is running the command must be able to modify.

w
Alternate syntax for.

weather
Sets the weather.


 * Syntax




 * Description


 * Changes the weather for the specified duration.


 * Success Conditions


 * must be at least 1, and cannot be greater than 1,000,000, and a valid weather condition must be provided.

whitelist
Adds or removes a player from a server whitelist.


 * Syntax




 * Description


 * Adds or removes player from the whitelist.


 * Success Conditions


 * Always succeeds.

whitelist list
Displays the server whitelist.


 * Syntax




 * Description


 * Displays all players in the whitelist.


 * Success Conditions


 * Always succeeds.

whitelist on|off
Turns the server whitelist on or off.


 * Syntax




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

whitelist reload
Reloads the server whitelist.


 * Syntax




 * Description


 * Reloads the list of playernames in  (1.7.5 or earlier) or   (1.7.6 or later) from disk (used when   or   has been modified outside of Minecraft).


 * Success Conditions


 * Always succeeds.

worldborder
These commands manage the world border.

worldborder add
Increases or decreases the worldborder diameter.


 * Syntax




 * 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


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

worldborder damage amount
Sets the damage inflicted outside the world border.


 * Syntax




 * Description


 * Sets the amount of damage inflicted per second per block past the world border buffer (defaults to 0.2). For example, if  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


 * must be at least 0.0.

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


 * Syntax




 * Description


 * Sets the buffer distance outside the world border before damage begins to be inflicted (defaults to 5.0).


 * Success Conditions


 * must be at least 0.0.

worldborder get
Displays the world border diameter.


 * Syntax




 * Description


 * Returns the current diameter of the world border.


 * Success Conditions


 * Always succeeds.

worldborder set
Sets the world border diameter.


 * Syntax




 * Description


 * Sets the diameter of the world border.  is the new diameter.   is the number of seconds it should take for the border to move from its previous location to the new location. If   is not specified, the diameter changes immediately.


 * Success Conditions


 * must fall within the range 1 to 60,000,000 (inclusive).

worldborder warning distance
Sets the world border warning distance.


 * Syntax




 * Description


 * Sets the distance inside the world border where visual warning of world border proximity begins (defaults to 5).


 * Success Conditions


 * must be at least 0.

worldborder warning time
Sets the world border warning time.


 * Syntax




 * 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  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


 * must be at least 0.

xp
Adds experience to a player.


 * Syntax




 * 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


 * can be at most 2,147,483,647.  is not optional in command blocks, and player must be online.

xp L
Increases or decreases a player's experience level.


 * Syntax




 * Description


 * Gives  the   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


 * must be between -2,147,483,648 and 2,147,483,647, inclusive.  is not optional in command blocks, and player must be online.