Skip to main content

/gamerule

Sets or queries a game rule. Game rules control various world behaviors like mob griefing, fire spread, keep inventory, and many more.

Category
Gameplay
Permission Level
Game Master
Version Added
1.4

Syntax

/gamerule <rule> [<value>]

Parameters

NameTypeRequiredDescription
rulegame_ruleRequiredThe game rule to query or modify (e.g., keepInventory, mobGriefing, doDaylightCycle).
valueboolean|integerOptionalThe value to set. Boolean rules accept true/false. Integer rules accept a number. If omitted, the current value is displayed.

Examples

/gamerule keepInventory true

Players keep their inventory and XP when they die.

/gamerule doDaylightCycle false

Stops the day-night cycle, freezing time at the current position.

/gamerule randomTickSpeed 10

Increases the random tick speed to 10 (default 3), making crops grow faster.

Common Mistakes

Notes

There are many game rules in Java Edition. Common ones: keepInventory, mobGriefing, doDaylightCycle, doWeatherCycle, doFireTick, commandBlockOutput, sendCommandFeedback, doInsomnia, playersSleepingPercentage.

Related Commands

Need a Minecraft server?

Try these commands on Astroworld or host your own server.

Try Astroworld Hosting