Change game rules on your Minecraft server: keep inventory and more

Turn on keep inventory or stop mob griefing and the day-night cycle with game rules, with the new names since 1.21.11 and the old ones next to them.

EliteStarHosting Team2 November 20263 min read

With game rules you set the rules of play in your world. Do players keep their items when they die? Can creepers blow up blocks? Does time pass? You change them with the gamerule command, simply while your server is running. What you set is saved, even after a restart.

Changing a game rule

In the game panel's console, type gamerule, the name of the rule and the new value:

gamerule keep_inventory true

In the game you type the same with a / in front, if you are an operator. Leave out the value to see the current setting, for example with gamerule keep_inventory.

The console with a command and the server's answer

New names since 1.21.11

Since Minecraft 1.21.11, all game rules have new names in lower case with underscores, such as keep_inventory instead of keepInventory. A few also have a really different name. Is your server on 1.21.11 or newer, such as 26.1? Then use the new name. On an older version, use the name in brackets below. Note that the names are case sensitive.

  • keep_inventory (keepInventory): players keep their items and XP when they die. Default false.
  • mob_griefing (mobGriefing): with false, creepers no longer blow up blocks and endermen don't pick anything up. Villagers then also stop harvesting crops. Default true.
  • advance_time (doDaylightCycle): with false, time stands still. Want it to be day all the time? Type time set day first. Default true.
  • advance_weather (doWeatherCycle): with false, the weather stays as it is. Default true.
  • fire_spread_radius_around_player: how many blocks around a player fire can spread. With 0, fire no longer spreads. Default 128. On older versions you turn that off with doFireTick false.
  • pvp: with false, players can't damage each other. Default true.
  • command_blocks_work (in 1.21.9 and 1.21.10: commandBlocksEnabled): turns command blocks on or off.
  • players_sleeping_percentage (playersSleepingPercentage): what percentage of players must sleep to skip the night. Default 100. With 0, one sleeping player is enough.
  • immediate_respawn (doImmediateRespawn): players come back straight away, without the death screen. Default false.
  • spawn_phantoms (doInsomnia): with false, phantoms no longer appear. Default true.

Is your server on a version from before 1.21.9? Then PvP and command blocks are still in server.properties, see Set up server.properties. You find all game rules on the Minecraft Wiki.

Paper and Purpur: each dimension separately

On Paper, Purpur and Spigot, each dimension has its own game rules. A command in the console only applies to the normal world, the overworld. In the game it applies to the dimension you are in at that moment. Want keep inventory in the Nether and the End too? Then also type:

execute in minecraft:the_nether run gamerule keep_inventory true
execute in minecraft:the_end run gamerule keep_inventory true

On an older version, use the old name here too. On Vanilla and Fabric, a game rule applies to all dimensions at once.

A new world

Game rules belong to a world. If you create a new world, it starts with the default values again. So set your game rules again afterwards.