Want players to keep their items after dying, or stop creepers from damaging builds? Use the gamerule command while your Minecraft Java server is running. You do not need to edit a file or restart.
Choose the command for your version
Check your game version in Console. Minecraft 1.21.11 and newer use the names below. Minecraft 1.21.10 and older use the older names shown beside them.
| Goal | 1.21.11 and newer | 1.21.10 and older |
|---|---|---|
| Keep inventory | gamerule minecraft:keep_inventory true | gamerule keepInventory true |
| Stop mob block changes | gamerule minecraft:mob_griefing false | gamerule mobGriefing false |
| Pause the day/night cycle | gamerule minecraft:advance_time false | gamerule doDaylightCycle false |
Mob griefing also controls whether mobs pick up items. Check your farms after turning it off, rather than treating it as a setting for creepers alone.
Check or undo a change
- Open Console and enter your chosen command without a leading slash. In game, operators use the same command with a slash.
- Enter the rule without its true or false value to check it. For example, gamerule minecraft:keep_inventory.
- To undo the change, use false for keep inventory or true for mob griefing and the daylight cycle.
A rule that is not recognized usually has the wrong name for your version. Plugins can also override game behavior. These examples are for Java Edition, not Bedrock.
On Paper, worlds and dimensions can have separate rules. Test the Nether and End too. Join the world you want to change, then enter its gamerule command in chat with a leading / as an operator. See Paper’s world and dimension notes.
Mojang’s 1.21.11 release notes cover the game rule changes. Read our command block guide for that separate rule.
Troubleshooting checks
| What you see | What to check |
|---|---|
| Unknown game rule | Choose the syntax for the installed Java version. Older camelCase names and newer namespaced names differ. |
| A rule works in one world but not another | Check the world or dimension where you tested. On Paper, verify the affected worlds separately. |
Your feedback helps us improve our guides.


