---
title: "Game rules, difficulty and game mode on your Minecraft server"
url: https://help.endercloud.in/docs/gamerules-difficulty-and-gamemode
category: "Minecraft Hosting"
type: Guide
tags: ["commands", "minecraft", "properties"]
keywords: "keep inventory, keepinventory, keep_inventory, stop daylight cycle, always day, one player sleep, players sleeping percentage, mob griefing, creative mode, survival mode, difficulty hard, defaultgamemode, gamerule list, gamerule, game rules, change difficulty, change gamemode, peaceful mode, keep inventory on, keepinventory not working, gamemode creative command, turn off mob griefing"
difficulty: beginner
time: "6 minutes"
updated: 2026-11-14
source: Endercloud Knowledge Base (official)
---

# Game rules, difficulty and game mode on your Minecraft server

> Use /gamerule (for example keep_inventory on 1.21.11+, keepInventory on older versions), /difficulty and /gamemode. Set the defaults for new players in Properties.

Game rules, difficulty and game mode are changed with commands. Type them in the panel **Console** without a `/`, or in game with a `/` if you are an op. Changes apply instantly and are saved with the world, so they survive restarts.

## Game rules (Java Edition)

The command is `gamerule <rule> <value>`. Type `gamerule <rule>` with no value to see the current setting.

> **Warning:**
> **The names changed in Minecraft 1.21.11.** All game rules were renamed from camelCase (`keepInventory`) to snake\_case (`keep_inventory`), and some got completely new names. Use the column that matches your server version (shown in the **Versions** tab as Installed Minecraft Version). In game, press Tab after `/gamerule` to see the names your version uses.

| What it does | 1.21.11 and newer (incl. 26.x) | 1.21.10 and older |
| --- | --- | --- |
| Keep items and XP when you die | `keep_inventory true` | `keepInventory true` |
| Stop day/night (time freezes) | `advance_time false` | `doDaylightCycle false` |
| Stop weather changing | `advance_weather false` | `doWeatherCycle false` |
| Only one player needs to sleep | `players_sleeping_percentage 0` | `playersSleepingPercentage 0` |
| Stop creepers and endermen breaking blocks | `mob_griefing false` | `mobGriefing false` |
| Stop all mobs spawning naturally | `spawn_mobs false` | `doMobSpawning false` |
| No phantoms | `spawn_phantoms false` | `doInsomnia false` |
| Respawn instantly (no death screen) | `immediate_respawn true` | `doImmediateRespawn true` |
| Hide advancement messages in chat | `show_advancement_messages false` | `announceAdvancements false` |
| Turn PvP off | `pvp false` | 1.21.9–1.21.10: `pvp false`. Older: `pvp` in **Properties** |

For the sleeping rule, `0` or `1` lets any single player skip the night; `50` means half the players online must sleep. The default is `100` (everyone).

On Paper, Purpur and Spigot, game rules are set per world. A rule typed in the console applies to the main overworld; run it in game while standing in the Nether or End, or use a plugin, to change those worlds too.

## Difficulty

```
difficulty peaceful
difficulty easy
difficulty normal
difficulty hard
```

A Java server applies the `difficulty` value from **Properties** every time it starts, so set it there too or your change will be undone at the next restart. Hardcore servers are always on hard. See [server.properties explained](/docs/server-properties-explained).

## Game mode

```
gamemode creative Steve
gamemode survival Steve
gamemode adventure @a
gamemode spectator Steve
```

-   In game you can leave out the name to change your own mode: `/gamemode creative`. In the console you must give a name.
    
-   `defaultgamemode survival` sets the mode for players joining for the first time. You can also set `gamemode` in **Properties**.
    
-   Turn on `force-gamemode` in **Properties** to put everyone back into the default mode every time they join.
    

## Bedrock Edition differences

-   Game rule names are all lowercase and use the older names: `gamerule keepinventory true`, `gamerule dodaylightcycle false`, `gamerule playerssleepingpercentage 0`, `gamerule mobgriefing false`, `gamerule pvp false`.
    
-   Bedrock has some rules Java doesn't, such as `gamerule showcoordinates true`.
    
-   Game mode and difficulty accept short forms: `gamemode c Steve`, `gamemode s Steve`, `difficulty h`.
    
-   On a Bedrock server, players need operator permission, and the world must allow cheats (`allow-cheats=true` in `server.properties`) for most of these commands to work in game. The server console can always run them.
    

## Frequently asked questions

**Q: "Incorrect argument for command" when I type keepInventory**

Your server is on 1.21.11 or newer, which uses the new names. Type `gamerule keep_inventory true` instead.

**Q: How do I see all game rules?**

In game, type `/gamerule` (with a space) and press Tab to scroll through every rule your version supports.

**Q: "Unknown or incomplete command" in game**

You are not an op. Run `op YourName` in the console first. See [Whitelist, op and ban players](/docs/whitelist-op-and-ban-players).
