Commands/gamemode

From Minecraft Wiki
Jump to: navigation, search
gamemode
Restrictions

Operator

First introduced

Beta 1.8 (Pre-release)
PE Alpha 0.16.0 (PE Alpha 0.16.0 build 1)

Sets a player's game mode.

Syntax[edit]

  • Java Edition
gamemode [adventure|creative|spectator|survival] [<target>]
  • Bedrock Edition
gamemode <gameMode: GameMode> [player: target]
An alternate syntax allows player to enter game mode by its number:
gamemode <gameMode: int> [player: target]

Arguments[edit]

adventure|creative|spectator|survival (BE: gameMode: GameMode or gameMode: int)

Must be one of:
"hardcore" is not a valid option for the mode argument, as it is technically not a game mode.

<target> (BE: player: target)

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, it is not optional.
Entities other than players are not allowed.

Result[edit]

Fails if the arguments are not specified correctly, or if <target> fails to resolve to one or more online players.

On success, changes the game mode of the default or specified players.

Examples[edit]

  • To put all players into survival mode
    gamemode survival @a

See also[edit]

  • /defaultgamemode – sets the initial game mode for players joining the world.

History[edit]

Java Edition Beta
1.8Pre-releaseAdded /gamemode <player> <mode>. The command requires a player and numeric gamemode.
Java Edition
1.3.112w16a/gamemode is now usable in singleplayer.
Syntax changed to /gamemode <mode> <player>, where player is now optional (defaulting to the sender) and mode can be a number, or one of survival, creative, s, or c.
12w30aChanged the ID for survival mode from 3 to 0, changing /gamemode 3 to /gamemode 0.
1.814w05aAdded spectator to /gamemode.
1.915w43a/gamemode now displays in the chat the gamemode the player switches to.
16w02aThe m selector now accepts the standard literal gamemode values and abbreviations, such as a and adventure, and these may be negated as well (e.g., @a[gamemode=!survival]).
1.1317w45aRemoved abbreviated forms and numeric IDs.
Pocket Edition Alpha
0.16.0build 1Added /gamemode.
Functionality is almost equivalent to Java Edition 1.10 usage, except /gamemode can only use Creative and Survival modes.
Pocket Edition
1.1.0alpha 1.1.0.0Added adventure to /gamemode.