Commands/gamerule

Sets or queries a game rule value.

Syntax

 * Java Edit


 * Bedrock Edition

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.
 * 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  or   specified for predefined game rules can affect gameplay, except in the case of ,  ,  ,  ,   and   where any integer affects (-2147483648~2147483647) gameplay; see Game rule.
 * Only  or   specified for predefined game rules can affect gameplay, except in the case of ,  ,  ,  ,   and   where any integer affects (-2147483648~2147483647) gameplay; see Game rule.

Examples

 * To stop the day-night cycle:
 * To stop natural healing:
 * To stop creepers, ghasts and other mobs from modifying blocks:
 * To stop the natural cycle of weather:
 * For the player, so that they can keep all of their valuables when they die:
 * To stop TNT from exploding:
 * To stop command blocks from showing what they do:
 * To stop phantoms spawning: