Using Game Rules
Game rules let you tweak how your world behaves, from keeping your inventory on death to freezing the day/night cycle. They're changed with the /gamerule command and apply to the world you run them in.
Setting a Game Rule
/gamerule <rule> <value>
Most rules take true or false, while a few take a number. To check the current value of a rule, run the command without a value, e.g. /gamerule keepInventory.
Commonly Used Game Rules
| Rule | What it does |
|---|---|
keepInventory | Players keep their items and XP when they die. |
doDaylightCycle | Set to false to freeze the time of day. |
doWeatherCycle | Set to false to stop weather from changing. |
mobGriefing | Controls whether mobs can change blocks (creeper explosions, endermen, etc.). |
doMobSpawning | Set to false to stop natural mob spawning. |
doFireTick | Set to false to stop fire from spreading and burning out. |
randomTickSpeed | How fast crops grow and leaves decay. Default is 3. |
showDeathMessages | Toggles death messages in chat. |
announceAdvancements | Toggles advancement announcements in chat. |
tip
Game rules are per-world. If your server has multiple worlds (for example a separate creative world), run the command in each world you want to change.