Updated 4 November 2026
To keep your items when you die on a Minecraft Java server, type gamerule keep_inventory true in the console (Minecraft 1.21.11 and newer) or gamerule keepInventory true on older versions. Game rules are changed with a command, not in server.properties, and they take effect straight away without a restart.
Game rule names were checked on 29 October 2026 against the Minecraft Wiki's game rule reference. In Java snapshot 25w44a (part of 1.21.11) Mojang renamed all game rules to lowercase names with underscores, so guides written before that use the old names.
How to change a game rule
- Open your server in SparkPanel and go to the console.
- Type the rule without a slash, for example
gamerule keep_inventory true, and press Enter. In the game itself, as an operator, type the same with a slash:/gamerule keep_inventory true. - To see the current value, type the rule without a value:
gamerule keep_inventory.
/gamerule in the game chat and press Tab: Minecraft lists every rule your version knows.The rules people change most
| What you want | Java 1.21.11 and newer | Java before 1.21.11 | Bedrock |
|---|---|---|---|
| Keep items and XP on death | keep_inventory true | keepInventory true | keepinventory true |
| Creepers and endermen don't break blocks | mob_griefing false | mobGriefing false | mobgriefing false |
| One sleeping player skips the night | players_sleeping_percentage 0 | playersSleepingPercentage 0 | playerssleepingpercentage 0 |
| Always day (stop the clock) | advance_time false | doDaylightCycle false | dodaylightcycle false |
| No rain or thunder changes | advance_weather false | doWeatherCycle false | doweathercycle false |
| No attacking each other | pvp false (1.21.9+) | pvp=false in server.properties | pvp false |
| No phantoms | spawn_phantoms false | doInsomnia false | doinsomnia false |
| Skip the death screen | immediate_respawn true | doImmediateRespawn true | doimmediaterespawn true |
| Hide death messages in chat | show_death_messages false | showDeathMessages false | showdeathmessages false |
| Hide advancement messages | show_advancement_messages false | announceAdvancements false | (not on Bedrock) |
Bedrock rule names are not case-sensitive. The percentage rule means the share of online players that must sleep: 0 or a low number lets one player skip the night, 100 means everyone must sleep (the vanilla Java default is 100).
Good combinations
- Relaxed survival with friends:
keep_inventory true,players_sleeping_percentage 0,spawn_phantoms false. Nobody loses a full inventory in lava and nobody waits for the last player to go to bed. - Kids, a school class or a club: add
pvp falseandmob_griefing false, so nobody can hurt each other and creepers don't blow up builds. See Minecraft server for kids and Minecraft server for a school or club. - Building server:
advance_time falseandadvance_weather falsetogether with creative mode, so it's always a clear day.
Game rules or server.properties?
server.properties holds server settings such as difficulty, game mode, whitelist and view distance; they need a restart. Game rules belong to the world, are changed with gamerule and work at once. Both are explained in server.properties explained. Because game rules are stored in the world, they move with it when you upload a singleplayer world.
Which plan?
Game rules don't use extra memory. A vanilla or Paper server for a few friends runs on 2 GB (€1.89 per month paid per quarter, €2.19 with monthly billing); with plugins or 5 to 15 players, take 4 GB (€4.19 / €4.39). See Minecraft server hosting.
Frequently asked questions
How do I turn on keepInventory on my Minecraft server? Type gamerule keep_inventory true in the server console (Java 1.21.11 and newer) or gamerule keepInventory true on older Java versions. On Bedrock it is gamerule keepinventory true. No restart is needed.
Why does gamerule keepInventory say unknown game rule? Your server runs Minecraft 1.21.11 or newer, where game rules were renamed to lowercase with underscores. Use keep_inventory instead.
Do I need to restart after changing a game rule? No. Game rules take effect immediately and are saved in the world.
How do I make one player enough to skip the night? Set gamerule players_sleeping_percentage 0 (playersSleepingPercentage on Java before 1.21.11, playerssleepingpercentage on Bedrock).
How do I stop creepers from destroying builds? Set gamerule mob_griefing false. Note that this also stops villagers from farming and endermen from picking up blocks.