How to change game rules in Minecraft
Type /gamerule keep_inventory true in chat as an operator or in the server console. Run /gamerule <rule> with no value to see its current setting.
gamerule
Shows or changes a game rule, such as keeping inventory on death or the percentage of players needed to sleep.
/gamerule <rule> [<value>] Examples
/gamerule keep_inventory true Players keep their items when they die.
/gamerule players_sleeping_percentage 50 Half the players need to sleep to skip the night.
/gamerule mob_griefing Shows the current value.
Arguments
ruleRequired- Game rule name, for example
keep_inventory. valueOptionaltrue/falseor a number, depending on the rule.
What it does
Without a value it prints the current setting; with one it changes it right away. In 26.x game rules use snake_case names like keep_inventory and mob_griefing, and the old camelCase names from older versions such as keepInventory no longer work; the minecraft: prefix is optional. Game rules are saved with the world, not in server.properties.
Good to know
- Needs operator permission level 2.
Run it on your server
On a SLASHPLAY server, type it in the Console tab without the leading slash; in game, operators type it in chat with the slash. New to this? Start a Minecraft server first.
Your own
Minecraft server.
From $0.03 an hour, only while it runs. New accounts get 6 free tokens.