/defaultgamemode
< Commands
This feature is exclusive to Java Edition.
/defaultgamemode| Permission level required |
2 |
|---|---|
| Restrictions |
None |
{
"title": "<code>/defaultgamemode</code>",
"rows": [
{
"field": "2",
"label": "(link to Permission level article, displayed as Permission level<br>required)"
},
{
"field": "None",
"label": "(link to Commands#Restrictions article, displayed as Restrictions)"
}
],
"invimages": [],
"images": []
}
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:
survivalfor Survival modecreativefor Creative modeadventurefor Adventure modespectatorfor Spectator mode
Result
| Command | Trigger | Java Edition |
|---|---|---|
| Any | The command is incomplete, or any argument is not specified correctly. | Unparseable |
| Otherwise | Successful |
Output
| Command | Edition | Situation | Success Count | /execute store success ... | /execute store result ... |
|---|---|---|---|---|---|
| Any | Java Edition | If in multiplayer, and force-gamemode in the server.properties file is true | 1 | 1 | the number of online players whose game mode is changed |
| Java Edition | If in LAN world | 1 | 1 | the number of online players whose game mode is changed | |
| Otherwise | 1 | 1 | 0 |
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.1 | 12w22a | Added /defaultgamemode. | |||||
| 1.8 | 14w05a | Added spectator to /defaultgamemode. | |||||
| 1.19.3 | 22w45a | Now this command accepts a gamemode argument, instead of literal subcommands. | |||||