Skip to main content

For servers

Server behavior​

The mod respects the vanilla playerSleepingPercentage gamerule.

If this value is set below 100%, only players who actually slept during the night will receive:

  • the Rested effect
  • the night summary

Players who did not sleep will not receive these rewards.

The summary is sent once the night is over and every sleeper has left the bed. Mods that pass the night gradually while players stay in bed, such as Better Days or Seamless Sleep, are supported: the summary waits until those players get up.


Server options​

The server section of the config has two options. Both can also be changed in the config screen, in the Server behaviour section, when you play in single player.

"server": {
"resetPhantomTimerForNonSleepers": true,
"suppressVanillaSleepMessages": true
}

Rest counter handling​

resetPhantomTimerForNonSleepers controls how the phantom rest timer (timeSinceLastRest) is reset when the night is skipped.

  • The rest timer is reset for all players
  • Even players who did not sleep will have their counter reset
tip

Prevents situations where players who didn't participate in skipping the night are still targeted by phantoms later.

Vanilla sleep messages​

suppressVanillaSleepMessages hides the built-in "players sleeping" and "skipping night" lines, since the mod already shows its own sleeping players plate. Set it to false to bring the vanilla messages back.


Version matching​

The mod syncs config and content between server and client over its own network channel, and that channel carries a protocol version.

warning

Client and server must run the same mod version. A mismatched client is rejected at connect time with a clear message rather than joining and misbehaving later. A 1.5.x client cannot join a 1.6 server.

Install the same jar on the server and on every client and there is nothing else to configure.


Server-authoritative settings​

When a player joins, the server sends its own config, and that copy is used for the session. Overlay timings, opacity, comfort weights and thresholds, the theme and the HUD toggles are therefore identical for everyone, regardless of what each player has in their local file. The only exception is the summary size, summaryScale, which each player keeps for their own monitor.

note

While connected to a server, the in-game config screen shows no sections, only a note that the settings come from the server's config file. Server owners change settings in config/midnightthoughts.json on the server.

Changes take effect without a restart:

/midnightthoughts reload config

The file is re-read, validated, and pushed to everyone currently online. To start over with a clean file, use /midnightthoughts config recreate, the old file is kept as a backup. See commands for the full list.


The sleeping players plate​

While anyone is asleep, a small plate in the corner shows how many players are sleeping out of how many are online, for example Sleeping 2/5. It updates as players get in and out of bed, and also when someone joins or leaves, so the denominator never goes stale.

Only players in the Overworld are counted, the same as for vanilla night skipping. Spectators are not counted in the total.

"ui": {
"hideSleepingPlayersHud": false
}

Set it to true to hide the plate entirely. It is off by default, meaning the plate is shown.

The plate also hides by itself while the F3 debug screen is open, so it never covers the debug text.

note

On a single-player world the plate is not particularly useful, but it is not hidden automatically. Some players like the confirmation that the night is being skipped.


Data safety​

Two things get written to disk regularly: the config and per-player statistics.

Both are written atomically: the mod writes a temporary file and swaps it into place, so a crash or a power cut during a save leaves the previous version intact instead of a truncated file.

Statistics are held in memory while the server runs and flushed when a player disconnects and on shutdown, rather than being re-read for every access.

tip

If a stats or config file is ever damaged from the outside, the mod renames it with a .broken suffix, regenerates a clean one, and logs what it did. Nothing is silently deleted.


Performance​

Comfort scans are the only meaningful per-player work. A scan only runs when a player interacts with a bed, and the result is cached per player and per bed position for a short window, so it is not repeated on every tick.

note

In profiling on a live server, the mod accounts for a fraction of a percent of the server tick. Raising scanRadius to its maximum of 8 increases the scanned volume noticeably. If you run a large server and want to be careful, that is the one number worth watching.


Extending behaviour​

Server owners who want custom rules, such as a dimension that is always uncomfortable, a reward when someone becomes MVP or a debuff after a nightmare, can script it with KubeJS without writing a mod, or hook the Java API from an existing one.