How to change the difficulty and game mode on a Minecraft server
You can change the difficulty and game mode in two ways: with a command, which works instantly, or in the settings file, which keeps it for good.
Difficulty
Quickly, with a command in the panel console (without /) or in game as OP (with /):
difficulty hard
Options: peaceful, easy, normal, hard.
To make it permanent, set difficulty=hard in server.properties. The server reads it on the next start.
Game mode for one player
gamemode creative Nick
Modes: survival, creative, adventure, spectator.
Game mode for all new players
In server.properties:
gamemode=survival- the mode new players start in,force-gamemode=true- every player gets thegamemodemode when they join, even if they had a different one before.
Hardcore mode
Set hardcore=true in server.properties. It is best to turn on hardcore before the world is generated, because it works most reliably on a new map. When players die, they switch to spectator mode.
Frequently asked questions
The difficulty command does not work.
In game you need OP (how to give OP). In the panel console the command always works.
I set the difficulty in server.properties but after a restart it is different.
If you changed the difficulty with a command before, the world may have saved that value. Type difficulty with the level you want in the console, and the setting is saved.
Pepe