Sets or queries a game rule value.
- Java Edition
gamerule <rule name> [<value>]
- Bedrock Edition
gamerule <rule: BoolGameRule> [value: Boolean]
gamerule <rule: IntGameRule> [value: int]
- In Bedrock Edition, gamerules can also be changed in the world options and certain gamerules can be toggled on and off with the command without cheats enabled. This only works in singleplayer, server gamerules and server settings cannot be adjusted using the client settings, even if a player is opped.
<rule name> (BE:
rule: BoolGameRule or
- Specifies the game rule to set or query. Must be one of the predefined game rules; see Game rule.
value: Boolean or
value: int) (optional)
- Specifies the value to set the game rule to. Only
falsespecified for predefined game rules can affect gameplay, except in the case of
maxCommandChainLengthwhere any integer 0 or greater affects gameplay; see Game rule.
Fails if the arguments are not specified correctly.
On success, returns the value of the game rule (if
<value> is not provided) or sets the game rule to the specified value (if
value is provided).
- To stop the day-night cycle:
gamerule doDaylightCycle false
- To stop natural healing:
gamerule naturalRegeneration false
- To stop creepers, ghasts and other mobs from modifying blocks:
gamerule mobGriefing false
- To stop the natural cycle of weather:
gamerule doWeatherCycle false
- For the player, so that they can keep all of their valuables when they die:
gamerule keepInventory true
- To stop TNT from exploding:[BE only]
gamerule tntExplodes false
|1.8||14w03a||Added the ability to create custom dummy gamerules.|
|Values to |
|1.0.5||alpha 188.8.131.52||Added |
|?||Command segments |