Direct answer
On Java 1.21.11 and 26.x, run /gamerule keep_inventory true as an operator. On Java 1.21.10 and earlier, use /gamerule keepInventory true. No world-file editing is needed.
Recommended procedure
- Confirm your Minecraft Java version and use an operator account or the server console.
- Run
/gamerule keep_inventory true(newer Java) or/gamerule keepInventory true(older Java). In the server console, omit the leading slash. - Query the value with
/gamerule keep_inventoryor the matching legacy name. - Turn it off by replacing
truewithfalse.
Why this matters
This gamerule changes what happens to players’ inventory and experience when they die; it does not restore items already lost. Check whether a multiverse or gameplay plugin overrides rules in specific worlds.
How to verify the result
Confirm the game rule reports true. On a test world with a backup, check death behavior using a non-OP player; plugins can override the vanilla result.
Version and compatibility notes
Mojang renamed Java game rules to snake-case resource identifiers in Java 1.21.11. Names and behavior differ between Java and Bedrock; this article covers Java servers. Do not blindly reuse commands from older tutorials.
Official references
Related guides
Help us improve this article
Tell us what is missing, unclear, outdated, or incorrect. You can also suggest something we should add.