Commands/gamerule

Sets or queries a game rule value.
==Syntax==
* Java Edition
: gamerule <rule name> [<value>]
* Bedrock Edition
: gamerule <rule: BoolGameRule> [value: Boolean]
: gamerule <rule: IntGameRule> [value: int]
==Arguments==
Arguments are case sensitive. Arguments are shown for tab autocompletion as lowercase, but when typed are case-insensitive. 
: 
: and 
: Specifies the game rule to set or query.
: Must be one of the predefined game rules; see Game rule.
: 
: and 
: Specifies the value to set the game rule to. If not specified, queries the value of the game rule instead of setting it.
: Only true or false specified for predefined game rules can affect gameplay, except in the case of maxEntityCramming, randomTickSpeed, spawnRadius, playersSleepingPercentage, functionCommandLimit and maxCommandChainLength where any integer affects (-2147483648~2147483647) gameplay; see Game rule.
==Result==
== Output ==
==Examples==
* 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: gamerule tntExplodes false 
* To stop command blocks from showing what they do: gamerule commandBlockOutput false
*To stop phantoms spawning:gamerule doInsomnia false
== History ==
==See also==
* – a command for controlling the spawning of raids, patrols, and wandering traders
de:Befehl/gamerule
ja:コマンド/gamerule
pt:Comandos/gamerule
ru:Команды консоли/gamerule
uk:Команди консолі/gamerule
zh:命令/gamerule