World

/gamerule

Game rules control world-wide behavior: keepInventory on death, mob spawning, daylight cycle, command output, fall damage, etc. Without a value, /gamerule queries the current setting.

Syntax

Parameters

rule
literal
e.g. keepInventory, doDaylightCycle, mobGriefing.
valueoptional
boolean | integer
New value. Omit to query.

Command builder

Configure the options below to generate a ready-to-paste /gamerule command.

/gamerule keepInventory true

Examples

  • Keep items on death.

  • Freeze the sun.

  • Stop creepers/endermen from breaking blocks.

  • Speed up plant growth, ore aging, etc.

Permission level

/gamerule requires Cheats (op level 2). In single-player you need the world's "Allow Cheats" toggle on. On a multiplayer server you need to be opped — see /op.