Keep inventory, daylight cycle and other game rules

Game rules are switches inside the world: keep inventory on death, whether the day cycle runs, mob griefing, and forty more. They are set with a command, by an operator or from the console.

From the console

In the Console tab:

gamerule keepInventory true
gamerule doDaylightCycle false
gamerule mobGriefing false
gamerule playersSleepingPercentage 1
gamerule doFireTick false

Rules apply at once and are saved with the world. gamerule alone lists them all.

Difficulty and the rest

Difficulty, spawn protection, command blocks, flight, view distance and player slots are server settings, not game rules: Settings, Server. They take effect on the next restart.

Save what you run often

Commands keeps named commands you can run with one click, and Scheduler runs them on a timer: a nightly save-all, a restart warning, a daily weather clear. See Custom commands and Scheduled tasks.

Good to know

  • Game rules are per world; a reset world starts with the defaults.
  • playersSleepingPercentage 1 lets one sleeping player skip the night on a busy server.
  • Some rules only exist on newer versions; the console says so when a rule is unknown.

Something missing or wrong? Tell us or ask in Discord.