Commands/defaultgamemode

Minecraft Wiki article. Categories: Java_Edition, Commands

📌 Mirrored from Minecraft Wiki

This article is reproduced from Commands/defaultgamemode on the Minecraft Wiki. Mirrored from revision 3693009. It is licensed CC BY-NC-SA 3.0 by the Minecraft Wiki contributors — not under the Codex’s CC BY-SA 4.0, and it may not be used commercially. Edits belong upstream, not here.

This feature is exclusive to Java Edition.
 
/defaultgamemode

Sets the default game mode (Creative, Survival, etc.) for new players entering a multiplayer server. If in multiplayer and force-gamemode in the server.properties file is true, or if in LAN world, all online players are set to this game mode.

Syntax

defaultgamemode <gamemode>

Arguments

<gamemode>: gamemode

Specifies the default game mode.
Must be one of the following:Note that "hardcore" is not a valid option, as it is technically not a game mode.

Result

CommandTriggerJava Edition
AnyThe command is incomplete, or any argument is not specified correctly. Unparseable
OtherwiseSuccessful

Output

CommandEditionSituationSuccess Count/execute store success .../execute store result ...
AnyJava EditionIf in multiplayer, and force-gamemode in the server.properties file is true11the number of online players whose game mode is changed
Java EditionIf in LAN world11the number of online players whose game mode is changed
Otherwise110

Examples

  • To set the default game mode to survival: defaultgamemode survival

See also

/gamemode – changes a player's game mode

History

Java Edition
1.3.112w22aAdded /defaultgamemode.
1.814w05aAdded spectator to /defaultgamemode.
1.19.322w45aNow this command accepts a gamemode argument, instead of literal subcommands.

Sources