What does the server difficulty property do?

While making edits to the server.properties file, I noticed there was a difficulty setting, which is currently set to 1.

I assume this is related to the client-side setting of the same name, but what options are valid in the properties file, and what does each difficulty setting change?


Solution 1:

Server Difficulties

The difficulty of a server is configured on the server-side, regardless of what a players client is configured as. The difficulty property is an integer and has 4 potential values. The value defaults to 1, or easy.

Peaceful

Peaceful mode is active when difficulty=0. Hunger is disabled, as is eating, and health is regenerated all the time. Hostile mobs spawn if spawn-monsters is true, but they are removed immediately. (It is worth, therefore, to also set spawn-monsters to false).

Easy

Easy is the default difficulty, and is active when difficulty=1. Hunger is enabled, but will only cause damage when Steve has more than 5 hearts. Hostile mobs have less health and cause less damage, while creepers have a smaller detection radius.

Normal

Normal mode is active when difficulty=2. Hunger is enabled, and can cause damage down to 0.5 hearts. Hostile mobs have 'normal' health and cause 'normal' damage (see table).

Hard

Hard mode is active when difficulty=3. Hunger is enabled, and can kill Steve. Hostile mobs deal greater damage and have a small amount of extra health. Creepers have a larger detection radius for triggering their attacks.

TL;DR:

| difficulty | id | hunger | zombie/enderman | skeleton | spider | creeper |
+------------+----+--------+-----------------+----------+--------+---------+
| peaceful   | 0  | n/a    | n/a             | n/a      | n/a    | n/a     |
| easy       | 1  | 5      | 1               | 1        | .5     | 5.5     |
| normal     | 2  | 0.5    | 2.5             | 2        | 2.5    | 10      |
| hard       | 3  | 0 (die)| 3.5             | 3        | 3.5    | 10.5    |