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.

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.

For example,  will teleport yourself to the coordinate (0, 64, 0), while   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,  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 the offset is from the starting position. Other common offsets include from the position of the command's execution or from another coordinate specified by the command.

Target selectors
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). Use tilde notation to specify a coordinate relative to the command's execution position.


 * 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
 * : survival mode
 * : creative 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 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).




 * 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.
 * plain text || Enter this literally, exactly as shown.
 * italics || Replace this with an appropriate value.
 *  || This is a required argument.
 * [square brackets] || This is an optional argument.
 * x | y
 *  || This is a required argument.
 * [square brackets] || This is an optional argument.
 * 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.

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
 * Specifies the coordinates of the block to be modified. May be provided in tilde notation to identify a position relative to the command's execution.


 * dataTag
 * Specifies the data tag elements to be added to, or overwrite elements of, the specified block. Must be a compound NBT tag (for example, ).


 * Result


 * Fails if arguments are not specified properly.


 * On success, modifies the data tag of the targeted block.


 * See also


 * — changes an entity's data tag
 * — replaces items in a block's inventory
 * – places a new block at a position
 * — sets a block's CommandStats

clear
Clears items from player inventory.


 * Syntax




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


 * To clear all items from Notch's inventory:


 * To clear all wool items from Notch's inventory:


 * To clear all orange wool items from the inventory of all players:


 * Future


 * Two additional arguments have appeared in development versions, but have not yet appeared in a full release:


 * maxCount (optional)
 * Specifies the maximum number of items to be cleared. If not specified, or if, clears all items. If  , does not clear items, but returns successfully if there were items that could have been cleared (allowing detection of items rather than clearing of items).


 * dataTag (optional)
 * Specifies the data tags of the item to be cleared (only items matching the specified data tags will be cleared — data tags not specified will not be considered). Must be a compound NBT tag (for example, ).


 * In addition, data can be set to  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:


 * See also


 * — give items to player

clone
Clones blocks from one region to another.


 * Syntax




 * 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,  has a 1-block volume, and   and   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:
 * — Clone only blocks with the specified block id (see TileName below).
 * — Copy only non-air blocks. Blocks in the destination region that would otherwise be overwritten by air are left unmodified.
 * — Copy all blocks, overwriting all blocks of the destination region with the blocks from the source region.
 * If not specified, defaults to.


 * mode2 (optional)
 * Must be one of:
 * — Force the clone even if the source and destination regions overlap.
 * — 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.
 * — Don't move or force. Used when TileName also needs to be specified.
 * If not specified, defaults to.


 * TileName (optional)
 * Specifies the block id (for example, ) 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 a region with a block

debug
Starts or stops a debugging session.


 * Syntax




 * Arguments


 * Starts a new debug profiling session.
 * Starts a new debug profiling session.


 * Stops the active debug profiling session.
 * Stops the active debug profiling session.


 * Result


 * Fails if tried to start a debug session when one is already active, or if tried to stop a debug session when none is running.


 * On success, starts or stops the debug session. While active, includes notifications about potential performance bottlenecks in the console. When stopped, creates a profiler results file in the folder "debug".


 * Future


 * An additional option with additional arguments has appeared in development versions, but a full update containing these features has not yet been released:




 * x, y, and z are valid only with the chunk option, and are not optional with it.

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


 * Syntax




 * Arguments


 * mode


 * Must be one of three values:
 * (can be abbreviated as  or  ) for survival mode
 * (can be abbreviated as  or  ) for creative mode
 * (can be abbreviated as  or  ) 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:


 * Future


 * An additional value for the mode argument has appeared in development versions, but has not yet appeared in a full release:
 * (can be abbreviated as  or  ) for spectator mode


 * See also


 * – changes a player's game mode

deop
Revoke operator status from a player.


 * Syntax




 * Arguments


 * player
 * Specifies a player to remove from the list of operators. May be anything but target selectors will not evaluate and only actual player names will produce a useful result.


 * Result


 * Always succeeds if restrictions are satisfied. If player matches a name on the list of operators, the name is removed from the list and any player by that name no longer has operator status.


 * Examples


 * To remove Grumm from the list of operators:

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


 * Syntax




 * Arguments


 * new difficulty


 * Must be one of four values:
 * (can be abbreviated as  or  ) for peaceful difficulty
 * (can be abbreviated as  or  ) for easy difficulty
 * (can be abbreviated as  or  ) for normal difficulty
 * (can be abbreviated as  or  ) 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:


 * See also


 * – changes a player's game mode (creative, survival, etc.)

effect
These commands manage status effects on players.

effect
Adds or removes a status effect to or from players.


 * Syntax




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


 * To grant a Speed 3 effect to the nearest player for 60 seconds:


 * To clear any Haste effects from all players:


 * Future


 * The upcoming  target selector allows effects to be given to any entity, not just players.


 * Effects may be specified by name id (for example, ).


 * An additional argument has been added:




 * hideParticles (optional)
 * Specifies whether the particles of the status effect should be hidden. Must be either  or  . If not specified, defaults to.

effect clear
Clears all status effects from players.


 * Syntax




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


 * Future


 * The upcoming  target selector allows effects to be cleared from any entity, not just players.

enchant
Adds an enchantment to a player item.


 * Syntax




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


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


 * Future


 * Enchantments may be specified by name id (for example, ).

entitydata
Modifies the data tag of an entity.


 * Syntax




 * Arguments


 * entity
 * Specifies the entity(ies) to be modified. Must be an entity UUID or the  target selector.


 * dataTag
 * Specifies the data tag elements to be added to, or overwrite elements of, the specified entity. Must be a compound NBT tag (for example, ).


 * Result


 * Fails if arguments are not specified properly, or if entity fails to resolve to one or more non-player entities (players can not be changed).


 * On success, modifies the data tag of the targeted entity(ies).


 * Examples


 * To prevent all current zombies from picking up loot:

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

execute
Executes a command with a different user and position.


 * Syntax




 * 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 detect
Executes a command with a different user and position, but only if a certain block is detected.


 * Syntax




 * 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, ), and data must be a valid block data for that type of block or   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:


 * See also


 * — tests for a certain block at a specified position (including specific data tags)

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


 * Syntax




 * The fill command also has an optional alternate syntax when using the  option:




 * 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,  has a 1-block volume, and   and   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, ).


 * dataValue (optional)
 * Specifies the block data to use for the fill block. Must be between 0 and 15 (inclusive).


 * oldBlockHandling (optional)
 * Must be one of:
 * - 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.
 * - 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.
 * - Replaces only air blocks in the fill region with the specified block.
 * - Replaces only blocks on the outer edge of the fill region with the specified block. Inner blocks are not affected.
 * - 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.


 * dataTag (optional)
 * Specifies the data tag to use for the fill block (for example, contents of a chest, patterns on a banner, etc.). Must be a compound NBT tag (for example, ). Cannot be combined with the replaceTileName and replaceDataValue arguments.


 * replaceTileName replaceDataValue (optional)
 * Arguments are only valid when oldBlockHandling is . Cannot be combined with the dataTag argument.
 * Specifies the block id and data of the blocks in the fill region to be replaced. If replaceDataValue is not specified, data value is ignored when determining which blocks to replace. If both arguments are not specified, replaces all blocks in the fill region.


 * Result


 * Fails if arguments are not specified properly, if the fill region is not rendered, if the block volume of the fill region is greater than 32768, if dataValue or dataTag are invalid for the specified block id, or if no blocks were changed.


 * On success, changes blocks in the fill region to the specified block.

gamemode
Sets a player's game mode.


 * Syntax




 * Arguments


 * mode


 * Must be one of three values:
 * (can be abbreviated as  or  ) for survival mode
 * (can be abbreviated as  or  ) for creative mode
 * (can be abbreviated as  or  ) 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:  or
 * To put all players into survival mode:


 * Future


 * An additional value for the mode argument has appeared in development versions, but a full update containing these features has not been released yet:
 * (can be abbreviated as  or  ) for spectator mode


 * See also


 * defaultgamemode – sets the initial game mode for players joining the world

gamerule
Sets or queries a game rule value.


 * Syntax




 * Arguments


 * rule name
 * Specifies the game rule to set or query. May be any value, but game rules which affect actual game play include:
 * - Whether command blocks should notify admins when they perform commands
 * - Whether time progresses
 * - Whether fire should spread and naturally extinguish
 * - Whether mobs should drop items
 * - Whether mobs should naturally spawn
 * - Whether blocks should have drops
 * - Whether the player should keep items in their inventory after death
 * - Whether creepers, endermen, ghasts, withers and villagers should be able to change blocks and whether zombies, skeletons, and zombie pigmen can pick up items
 * - 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  or   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:


 * To stop natural healing:


 * Future


 * The following game rules have appeared in development versions, but the full update containing these features has not been released yet.
 * - Whether to log admin commands to server log
 * - 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).
 * - Whether the debug screen shows all or reduced infomation
 * - Whether the feedback from commands executed by a player should show up in chat
 * - 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,  defines a new game rule called   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).

give
Gives an item to a player.


 * Syntax




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


 * data (optional)
 * Specifies the item data of the given item(s). Must be an integer between -2,147,483,648 and 2,147,483,647 (inclusive, without the commas), but values which are invlaid for the specified item id default to 0. If not specified, defaults to 0.


 * dataTag (optional)
 * Specifies the data tag of the given item(s). Must be a compound NBT tag (for example, ).


 * Result


 * Fails if arguments are not specified properly, or if player fails to resolve to one or more online players.


 * On success, summons the specified item(s) at the location(s) of the target(s). If player resolves to multiple targets, each receives the specifed number of items. The item entity's Owner tag is set to the target and its PickupDelay tag set to 0 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":


 * See also


 * — summon any entity at any location

help
Provides help for commands.


 * Syntax




 * 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  (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 key) to explore available options for each argument.


 * Examples


 * To display the first page of the command list:  or


 * To display the third page of the command list:


 * To display the usage for the help 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




 * Result


 * Inflicts void damage to the user, killing them 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 to the user in the chat.


 * Future


 * A new argument has appeared in development versions, but a full update containing these features has not been released yet.




 * player|entity
 * Specifies the target(s) to be killed (including "non-living" entities like items, vehicles, etc.). Must be a player name or a target selector. If not specified, defaults to the command's user. Not optional in command blocks.


 * Fails if player|entity fails to resolve to one or more entities (named players must be online). On success, kills the targeted entities.


 * For example, to "kill" all item entities (making them vanish from the world):

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.

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




 * Arguments


 * name
 * Specifies the particle to create. Must be a particle name (for example, ).


 * x y z
 * Specifies the position at which to create the particle. All values (including y) must be between -30,000,000 and 30,000,000 (inclusive, without the commas). May use tilde notation to specify a position relative to the command's execution.


 * xd yd zd
 * Specifies the direction and velocity of the particle. Each argument is the velocity in blocks per second on a particular axis.


 * Exception: When name is  and count is 0 or not specified, specifies the color of the particle in RGB format offset from near-red (a random red tint between 0.8 and 1.0). For example,   produces a red particle,   produces a green particle (red is reduced to 0 and green increased to 1),   produces a purple particle (blue is added to the original red), etc. If count is greater than 0, colors are randomized.


 * speed
 * Specifies the speed of the particle. Must be at least 0.


 * count (optional)
 * Specifies the number of particle effects to create. Must be at least 0.


 * mode (optional)
 * Specifies the display mode. May be anything but only  will have an effect: to allow the particle(s) to be seen beyond the usual 16 block radius.


 * Result


 * Fails if arguments are not specified properly.


 * On success, creates the specified particle.


 * Examples


 * To create a huge stationary explosion 10 blocks to the east:

playsound
Plays a sound.


 * Syntax




 * Arguments


 * sound
 * Specifies the sound to play. Must be a sound event defined in sounds.json (for example, ).


 * A sound event may be affiliated with multiple sounds, and the sound which is actually produced will be chosen at random from them, modified by their "weight", just as the game normally would. For example, the  sound event will play one of several pig sounds at random, because the event has multiple sounds associated with it.


 * Resource packs may add their own events to sounds.json; the command will successfully play these. File names are not used by this command; it strictly uses the events defined in sounds.json (which may not even be similar to the original file names and paths), and thus a resource pack adding new sound files must define events for them (this is not necessary when replacing old sounds which are already in defined events).


 * player
 * Specifies the sound's target. Must be a player name or a target selector.


 * x y z (optional)
 * Specifies the position to play the sounds from. May use tilde notation to specify a position relative to the target(s).


 * volume (optional)
 * Specifies the distance that the sound can be heard. Must be at least 0.0. For values less than 1.0, the sound will be quieter and have a smaller sphere within which it may be heard. For values greater than 1.0, the sound will not actually grow louder, but its audible range (a 16-block radius at 1.0) will be multiplied by volume. There will always be a gradual falloff to silence based on distance from the center of the sphere.


 * pitch (optional)
 * Specifies the pitch of the sound. Must be between 0.0 and 2.0 (inclusive) — values lower than 1.0 lower the pitch and increase the duration, values greater than 1.0 raise the pitch and reduce the duration. The minimum pitch is 0.5; smaller values will result in identical sounds. If not specified, defaults to 1.0.


 * minimumVolume (optional)
 * Specifies the volume for targets outside the sound's normal audible sphere. If a target is outside the normal sphere, the sound will instead be centered some short distance from the target (less than four blocks away), and  will determine its volume. Must be between 0.0 and 1.0 (inclusive).


 * Result


 * Fails if arguments are not specified properly, if player fails to resolve to one or more online players, or if the targets are unable to hear the sound from where it is played.


 * On success, plays a sound for the targeted players.

publish
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 container.


 * Syntax




 * Arguments


 * x y z
 * Specifies the position of the block to be modified. May use tilde notation to specify a position relative to the command's execution.


 * slot
 * Specifies the inventory slot to be modified. Must be  where slot_number is replaced with a number specifying the slot.


 * Chests, dispensers, droppers, hoppers, and trapped chests are numbered 0 for the top-left slot and then increase first horizontally, then vertically (so, for example, a chest's top row slots are numbered 0 to 8). Double chests and double trapped chests are treated as two single container blocks. A brewing stand's bottom slots are numbered 0 to 2 from left to right, and its top slot is 3. A furnace's slots are numbered 0 for the input slot, 1 for the fuel slot, and 2 for the output slot. Other blocks which hold items but don't have inventory GUIs (flower pots, jukeboxes, etc.) can only be changed with.


 * item
 * Specifies the item to be placed in the block's inventory slot. Must be an item id, or a block id for which an item exists (for example, ).


 * amount (optional)
 * Specifies the number of items to be placed in the block's inventory slot. Must be between 1 and 64 (inclusive), even for items with a smaller stack size.


 * data (optional)
 * Specifies the item data for the item(s) to be placed in the block's inventory slot. Must be an integer between -2,147,483,648 and 2,147,483,647 (inclusive, without the commas), but values which are invalid for the specified item id will default to 0. If not specified, defaults to 0.


 * dataTag (optional)
 * Specifies the data tag for the item(s) to be placed in the block's inventory slot. Must be a compound NBT tag (for example, ).


 * Result


 * Fails if arguments are not specified properly, or if the specified block is not a container.


 * On success, replaces the items in the specified slot with the specified items (previous items in that slot are lost).


 * Examples


 * To replace the items in the bottom-right slot of a single chest one block above with 4 spruce saplings:


 * See also


 * — can also replace items in a container, but using data tags rather than slot IDs

replaceitem entity
Replace items in an entity's inventory.


 * Syntax




 * Arguments


 * selector
 * Specifies the entity to modify. Must be a player name or target selector.


 * slot
 * Specifies the inventory slot to be modified. Must be one of the following, where slot_number is replaced with a number specifying the slot:


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


 * item
 * Specifies the item to be placed in the entity's inventory slot. Must be an item id, or a block id for which an item exists (for example, ).


 * amount (optional)
 * Specifies the number of items to be placed in the entity's inventory slot. Must be between 1 and 64 (inclusive), even for items with a smaller stack size.


 * data (optional)
 * Specifies the item data for the item to be placed in the entity's inventory slot. Must be an integer between -2,147,483,648 and 2,147,483,647 (inclusive, without the commas), but values which are invalid for the specified item id will default to 0.


 * dataTag (optional)
 * Specifies the data tag for the item(s) to be placed in the entity's inventory slot. Must be a compound NBT tag (for example, ).


 * Result


 * Fails if arguments are not specified properly, if selector fails to resolve to one or more entities (named players must be online), or if the target does not have the specified slot (for example, zombies don't have ).


 * On success, replaces the items in the specified slot with the specified items (previous items in that slot are lost).


 * Examples


 * To replace the items in the rightmost hotbar slot of the nearest player with four spruce saplings:


 * See also


 * — give items to players without specifying specific inventory slots or overwriting other items

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




 * Arguments


 * x y z
 * Specifies the position of the block to be changed. May use tilde notation to specify a position relative to the command's execution.


 * TileName
 * Specifies the new block. Must be a block id (for example, ).


 * dataValue (optional)
 * Specifies additional data to further describe the new block. Must be between 0 and 15 (inclusive). If not specified, defaults to.


 * oldBlockHandling (optional)
 * Specifies how to handle the block change. Must be one of:
 * — The old block drops both itself and its contents (as if destroyed by a player). Plays the appropriate block breaking noise.
 * — Only air blocks will be changed (non-air blocks will be "kept").
 * — The old block drops neither itself nor any contents. Plays no sound.
 * If not specified, defaults to.


 * dataTag (optional)
 * Specifies the data tag for the new block. Must be a compound NBT tag (for example, ).


 * Result


 * Fails if arguments are not specified properly, if tried to change a non-air block in keep mode, or tried to replace a block with an identical copy in keep or replace mode.


 * On success, changes the block at the specified position.


 * See also


 * — modifies the data tags of a block
 * — copies blocks from one region to another
 * — fills a region with a block

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 world spawn.


 * Syntax




 * Arguments


 * x y z (optional)
 * Specifies the coordinates of the world spawn. x and z must be within the range -30,000,000 to 30,000,000 (inclusive). y must be between 0 and 256 (inclusive). If not specified, defaults to the position of the command's execution. Not optional in command blocks.


 * Players will always spawn on the top block near (x,z) — y is effectively ignored. Although spawn chunks are usually kept loaded at all times, new spawn chunks won't be loaded by this command until a player moves within range. Compasses (which in Minecraft point to the world spawn rather than north) will also not update to the change until the world is reloaded.


 * Result


 * Fails if arguments are not specified correctly.


 * On success, sets the world spawn to the specified coordinate.


 * Future


 * The ability to use tilde notation for x, y, and z to specify coordinates relative to the command's execution has appeared in development versions, but a full update with this feature has not been released yet.

spawnpoint
Sets the spawn point for a player.


 * Syntax




 * Arguments


 * player (optional)
 * Specifies the player whose spawn point should be set. Must be a player name or a target selector. If not specified, defaults to the command's user. Not optional in command blocks.


 * x y z (optional)
 * Specifies the coordinates of the player's new spawn point. x and z must be integers within the range -30,000,000 to 30,000,000 (inclusive). y must be an integer between 0 and 256 (inclusive). If not specified, defaults to the position of the specified player(s).


 * Result


 * Fails if arguments are not specified correctly, or if player fails to resolve to one or more online players.


 * On success, sets the spawn point of the targeted player(s) to the specified coordinate.


 * Future


 * The ability to use tilde notation for x, y, or z to specify coordinates relative to the command's execution has appeared in development versions, but a full update containing these features has not been released yet.

spreadplayers
Teleports players to random surface locations within an area.


 * Syntax




 * Arguments


 * x z
 * Specifies the center of the region to spread players to. x and z must be between -30,000,000 and 30,000,000 (exclusive).


 * spreadDistance
 * Specifies the minimum distance between players. Must be at least 0.0.


 * maxRange
 * Specifies the maximum distance on each horizontal axis from the center of the area to spread players (thus, the area is square, not circular). Must be at least 1.0 greater than spreadDistance.


 * respectTeams
 * Specifies whether to keep teams together. Must be  or  . If , players on the same team will be teleported to the same location.


 * player
 * Specifies the players to spread. Must be a list of player names separated by spaces, or a target selector.


 * Result


 * Fails if arguments are not specified properly, if there are too many players to satisfy the spreadDistance requirement within the specified area, or if a player is attempted to be spread to outside the world boundary.


 * On success, teleports players to random surface locations within the specified area. Players will always be placed on the top block at a location, and never on lava.


 * Examples


 * To teleport all players by team to random surface locations in a 1,000×1,000-block area centered on (0,0), with a minimum distance between teams of 200 blocks:


 * Future


 * The upcoming  target selector will allow the spreading of any entities (mobs, items, etc.).


 * The ability to use tilde notation for x and z to specify coordinates relative to the command's execution has appeared in development versions, but a full update with this feature has not been released yet.


 * See also


 * — teleports a single player or entity to a specific position (even underground).

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 (mobs, projectiles, items, vehicles, etc.).


 * Syntax




 * Arguments


 * EntityName
 * Specifies the entity to be summoned. Must be an entity id (for example,,  ,  ,  ,  , etc.).


 * x y z (optional)
 * Specifies the position to summon the entity. x and z must be between -30,000,000 to 30,000,000 (inclusive), and y must be at least 0. May use tilde notation to specify a position relative to the command's execution. If not specified, defaults to the position of the command's execution.


 * dataTag (optional)
 * Specifies the data tag for the entity. Must be a compound NBT tag (for example, ).


 * Result


 * Fails if arguments are not specified properly.


 * On success, creates the specified entity at the specified position.


 * Examples


 * To summon a charged creeper named "Powered Creeper" at the current position:


 * Future


 * The ability to summon lightning has appeared in development versions, but a full update containing these features has not been released yet. To summon lightning, specify EntityName as . For example, to summon lightning 10 blocks north of the current position:
 * Lightning has no additional data tags that can be specified.
 * Lightning has no additional data tags that can be specified.

tell
Sends a private message to one or more players.


 * Syntax




 * Arguments


 * player
 * Specifies the targeted player(s) to send the private message to. Must be a player name (or a target selector, but only if the user is an operator).


 * private message
 * Specifies the message to send. May include spaces (as well as target selectors, but only if run from the server console — in other words, from the computer running the server, or by remote access to it).


 * Result


 * Fails if any target selectors in either argument fail to resolve to at least one online player, or if a named player is not online.


 * On success, only the targeted player(s) see the private message in their chat.


 * Any target selectors in the private message will each resolve to one or more player names (as "name" for a single player, "name1 and name2" for two players, or "name1, name2, …, and nameN" for N players, without the quotes).


 * Examples


 * To privately tell Notch to start the mission:

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
Counts players matching specified conditions.


 * Syntax




 * Arguments


 * player
 * Specifies the player(s) to count. Must be a player name or a target selector.


 * Result


 * Fails if arguments are not specified properly, if player fails to resolve to one or more online players, or if not used in a command block or from the server console (in other words, the command cannot be used from the chat window).


 * On success, produces a success count equal to the number of players matching player, which can be measured by a redstone comparator facing away from the command block.


 * Examples


 * To test if Notch is online:


 * To count the number of players in survival mode within a 3-block radius of (0,64,0):


 * Future


 * The upcoming  target selector used in player permits testing for entities other than players. For example, to count the number of cows being rendered:


 * In recent development versions, the command can be used from the chat window.


 * An additional argument has appeared in development versions, but a full update containing these features has not been released yet:




 * dataTag (optional)
 * Specifies the data tags the players must have to match successfully. Must be a compund NBT tag (for example, ).


 * For example, to count the number of players currently flying:

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


 * Syntax




 * Arguments


 * x y z
 * Specifies the position of the block to test. x and z must be between -30,000,000 and 30,000,000 (inclusive, without the commas) and y must be between 0 and 255 (inclusive). May use tilde notation to specify a position relative to the command's execution.


 * TileName
 * Specifies the block to test for. Must be a valid block id (for example, ).


 * dataValue (optional)
 * Specifies the block data to test for. dataValue must be between -1 and 15 (inclusive). If not specified, or if, dataValue matches any block data value.


 * dataTag (optional)
 * Specifies the block data tags to test for. Must be a compound NBT tag (for example, ). If not specified, dataTag matches any block data tag.


 * Result


 * Fails if arguments are not specified properly, if the block at the specified position does not match the specified block id or data, or if the specified data tag has different values than are defined in the block's data tag (dataTag does not need to match the block's entire data tag, and data tags in the argument which are undefined in the block will not cause the command to fail).


 * On success, returns a success count of 1.


 * Examples


 * To test if the block at (0,64,0) is any type of wool:


 * To test if the block at (0,64,0) is orange wool:


 * To test if the block below is a jukebox with the "mall" record inside:

testforblocks
Tests whether the blocks in two regions match.


 * Syntax




 * Arguments


 * x1 y1 z1 and x2 y2 z2
 * Specifies two opposing corners of the region to use as the pattern to test for (the "source region"). x1, z1, x2, and z2 must all be between -30,000,000 and 30,000,000 (inclusive, without the commas), and y1 and y2 must be between 0 and 255 (inclusive). May use tilde notation to specify coordinates relative to the command's position. The number of blocks in the source region must not exceed 524,288.


 * x y z
 * Specifies the lower northwestern corner (the corner with the most-negative values) of the region to be checked (the "destination region"). x and z must both be between -30,000,000 and 30,000,000 (inclusive, without the commas), and y must be between 0 and 254 (inclusive). May use tilde notation to specify coordinates relative to the command's position. Source and destination regions may overlap.


 * mode (optional)
 * Specifies how to match blocks. Must be one of:
 * — every block in the source and destination regions must match exactly.
 * — air blocks in the source region will match any block in the destination region.
 * If not specified, defaults to.


 * Result


 * Fails if arguments are not specified properly, or if the source and destination regions do not match.


 * On success, returns the number of matching blocks (the total number of blocks in all mode, or the number of source region non-air blocks in masked mode).

time
Changes the world's game time.


 * Syntax




 * Arguments


 * value
 * Specifies the time to add or set. Must be between 0 and 2,147,483,647 (inclusive, without the commas), or, in set mode,  or.


 * Result


 * Fails if arguments are not specified properly.


 * On success, either adds value to the world's game time, or sets the world game time to value ( = 1,000,   = 13,000).


 * Examples


 * To set the time to 1,000:


 * To add one day to the world time:


 * Future


 * An additional mode has appeared in development versions, but a full update containing these features has not been released yet:


 * value
 * Specifies whether to query the time of day or the world time. Must be  or.
 * On success, returns the current time.
 * On success, returns the current time.

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




 * Result


 * Always succeeds. If weather is currently clear, rain or snow starts. If weather is currently rain or snow, stops.

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.

weather
Sets the weather.


 * Syntax




 * Arguments


 * Specifies to set the weather to clear weather.
 * Specifies to set the weather to clear weather.


 * Specifies to set the weather to rain (or snow in cold biomes).
 * Specifies to set the weather to rain (or snow in cold biomes).


 * Specifies to set the weather to a thunderstorm (or a thunder snowstorm in cold biomes).
 * Specifies to set the weather to a thunderstorm (or a thunder snowstorm in cold biomes).


 * duration in seconds
 * Specifies the time for the specified weather to last. Must be between 1 and 1,000,000 (inclusive, without the commas).


 * Result


 * Fails if arguments are not specified properly.


 * On success, changes the weather for the specified duration (in seconds).


 * Examples


 * To get clear weather for one Minecraft day:


 * To make it rain, but let it end at its own pace:

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




 * Arguments


 * amount
 * Specifies the amount of experience to give to the player. Must be between 0 and 2,147,483,647 (inclusive, without the commas).


 * If an  is added to the end, adds levels instead. Levels must be between -2,147,483,648 and 2,147,483,647 (inclusive, without the commas) — negative values remove levels instead of adding them.


 * player (optional)
 * Specifies the target of the command. Must be a player name or a target selector. If not specified, defaults to the command's executor. Not optional in command blocks.


 * Result


 * Fails if arguments are not specified properly, or if player fails to resolve to one or more online players.


 * On success, adds experience or adds/removes levels. Total experience and levels will not be reduced below 0.


 * Examples


 * To give 7 experience to yourself:


 * To give 3 levels to Notch:


 * To remove all levels from all players: