Minecraft gamerules: keep inventory and other useful settings

Server configuration · updated 28 November 2026

Gamerules are the rules of the game for a world. Type them in the panel console without a slash, or in game as an operator with a slash. They take effect immediately, no restart needed.

Important: the names depend on the game version

In Minecraft 1.21.11 the gamerule names changed. For example, keepInventory is now keep_inventory. Use the old name on an older version and the new one on a newer version. Not sure which one you have? Type /gamerule in the chat and press Tab, and the game lists the names it accepts.

The ones used most often

What it does1.21.11 and newerOlder versions
players keep their items when they diekeep_inventory truekeepInventory true
no phantomsspawn_phantoms falsedoInsomnia false
creepers and endermen do not break blocksmob_griefing falsemobGriefing false
one sleeping player skips the nightplayers_sleeping_percentage 1playersSleepingPercentage 1
stops the day and night cycleadvance_time falsedoDaylightCycle false
stops the weather cycleadvance_weather falsedoWeatherCycle false
mobs do not spawn on their ownspawn_mobs falsedoMobSpawning false
no advancement messages in the chatshow_advancement_messages falseannounceAdvancements false

Put gamerule in front of each of them, for example:

gamerule keep_inventory true

On an older version: gamerule keepInventory true. To check the current value, type just the name, for example gamerule keep_inventory.

Warning: turning off mob griefing (mob_griefing false) also stops villagers from picking up items and mobs from trampling crops. On a server with plugins, creeper protection is better set up in WorldGuard.

Several worlds

On Paper a gamerule applies to the world you are in. The Nether and the End have their own settings, so run the command there as well, for example with execute in minecraft:the_nether run gamerule keep_inventory true.

Frequently asked questions

keepInventory does not work and I get a command error.

You are on 1.21.11 or newer, so type gamerule keep_inventory true. On older versions watch the capital letters: keepInventory, not keepinventory.

Do gamerules stay after a restart?

Yes, they are saved in the world. After a world reset you need to set them again.