In short: /gamerule <rule> <value> changes a rule, and without a value it shows the current one. Since 1.21.11 rule names use underscores: keepInventory became keep_inventory, doInsomnia became spawn_phantoms. On Paper each world has its own rules, so set the Nether and the End separately.
The /gamerule command
The command needs operator level 2: run it from the server console or in chat as an operator. On Paper its permission is minecraft.command.gamerule, so you can give it to a moderator through a permissions plugin instead of OP — see LuckPerms. Arguments are case-sensitive in Java Edition.
gamerule keep_inventory # show the value
gamerule keep_inventory true # turn it on
gamerule players_sleeping_percentage 50A rule is either a boolean (true or false) or a number. Changes apply at once, no restart needed. On Paper the command changes the rule of the world it runs in; from the console that's the main world. For other worlds use execute in:
execute in minecraft:the_nether run gamerule keep_inventory true
execute in minecraft:the_end run gamerule keep_inventory trueSince 1.21.11 the rules have new names
In 1.21.11 Mojang moved game rules into a registry, and they all switched from camel case to lowercase names with underscores. Many were also renamed after their labels in the world creation menu, and a few had their value flipped: disableRaids became raids, so "raids on" is now true.
| Before 1.21.11 | Since 1.21.11 |
|---|---|
keepInventory | keep_inventory |
mobGriefing | mob_griefing |
doFireTick | removed, replaced by fire_spread_radius_around_player |
doInsomnia | spawn_phantoms |
spawnRadius | respawn_radius |
announceAdvancements | show_advancement_messages |
doDaylightCycle, doWeatherCycle | advance_time, advance_weather |
doMobSpawning | spawn_mobs |
commandBlocksEnabled | command_blocks_work |
disableElytraMovementCheck | elytra_movement_check (value flipped) |
Game rules worth knowing on a server
| Rule | Default | What it changes |
|---|---|---|
keep_inventory | false | Players keep their items and experience on death. Health, hunger and effects still reset |
mob_griefing | true | Mobs change blocks and pick up items: creepers blow up terrain, endermen carry blocks off, villagers farm. false turns all of it off at once, including piglins bartering for dropped gold |
fire_spread_radius_around_player | 128 | How far from a player fire can spread. 0 stops fire spread, -1 means no limit. Added in 1.21.11 to replace doFireTick |
spawn_phantoms | true | Whether phantoms spawn at night for players who haven't slept |
players_sleeping_percentage | 100 | What percentage of players in the Overworld must sleep to skip the night. 0 means one is enough, over 100 means the night is never skipped |
respawn_radius | 10 | How far from the world spawn a new player, or one without a personal spawnpoint, appears |
pvp | true | Whether players can damage each other. Since 1.21.9, replaces pvp in server.properties |
spawn_monsters | true | Whether monsters spawn naturally. Since 1.21.9, replaces spawn-monsters |
command_block_output | true | Whether command blocks notify admins about the commands they run — on a server with command blocks it floods the chat |
show_advancement_messages | true | Whether advancements are announced in chat |
show_death_messages | true | Whether player death messages appear in chat |
locator_bar | true | The locator bar that points toward other players (since 1.21.6) |
spectators_generate_chunks | true | Whether players in Spectator mode generate new chunks |
random_tick_speed | 3 | Random tick speed: plant growth, leaf decay. Higher means faster farms and more work for the server |
The rules servers change most are players_sleeping_percentage (so the night can be skipped without everyone online), spawn_phantoms, mob_griefing and command_block_output. Lobbies and minigames also freeze time and weather: advance_time false, advance_weather false. On a big world spectators_generate_chunks false helps: spectators stop generating new chunks — more on that load in pregenerating the world.
The vanilla server's movement checks
Two rules are the server's built-in speed checks: player_movement_check (player speed) and elytra_movement_check (speed on elytra). Both are on by default. The Minecraft Wiki notes that turning the elytra check off often helps with jittering from lag, which is why owners sometimes disable them.
Know the consequence: without them the server no longer stops too-fast movement by itself, and stopping speed cheats is entirely the anticheat's job. Before you turn them off, make sure your anticheat catches these cheats:
| Cheat | DGuard | GrimAC | Vulcan | Polar | Intave | Matrix |
|---|---|---|---|---|---|---|
| Speedfaster than the game allows | ||||||
| Flyflies without elytra or creative | ||||||
| ElytraFlycontrolled elytra flight | partly: not named — the simulation recreates 'most' movements | |||||
| Timerspeeds the game up |
Game rules and the anticheat
Game rules set the conditions, not fair play. keep_inventory changes the stakes: when death costs nothing, fights happen more often. fall_damage false makes NoFall pointless, but no rule turns off KillAura or Reach — the fight still goes to whoever runs the cheat. DGuard — the best anticheat for a modern Minecraft server — catches cheats in combat, movement, packets, inventory, building and the world under any rules, gathers evidence without rushing to a verdict, and you set how strict the punishments are.
Game rules aren't the same as server rules for players: what's forbidden and how it's punished is your call, and it's worth writing down. The free rules generator helps.
FAQ
How do I turn on keepInventory on a server?
On 1.21.11 and newer run /gamerule keep_inventory true, on older versions /gamerule keepInventory true. On Paper each world has its own rule: for the Nether and the End run it through execute in.
Why does /gamerule keepInventory give an error?
Since 1.21.11 the rules are renamed: it's keep_inventory now. Also check the letter case — command arguments are case-sensitive in Java Edition.
How do I stop fire from spreading?
On 1.21.11 and newer run /gamerule fire_spread_radius_around_player 0. Before 1.21.11 /gamerule doFireTick false did the same.
How do I let one sleeping player skip the night?
Set /gamerule players_sleeping_percentage 0: at 0 or below, one sleeping player skips the night. A value over 100 stops the night from being skipped at all.
Sources
- Minecraft Wiki: game rules
- Minecraft Wiki: the /gamerule command
- Minecraft Wiki: server.properties
- Paper: vanilla command permissions
- Paper: per-world game rules in the /gamerule code
- Paper 26.1: world storage and per-world game rules
- DGuard, the best anticheat for a modern Minecraft server: checks compared with GrimAC, Vulcan, Polar, Intave and Matrix
- DGuard: installation, requirements and troubleshooting
- DGuard: supported Paper and Leaf versions