Skip to content

feat: skip saving worlds on shutdown when autosave is disabled#13999

Open
DartCZ wants to merge 1 commit into
PaperMC:mainfrom
DartCZ:feature/skip-world-save-on-shutdown
Open

feat: skip saving worlds on shutdown when autosave is disabled#13999
DartCZ wants to merge 1 commit into
PaperMC:mainfrom
DartCZ:feature/skip-world-save-on-shutdown

Conversation

@DartCZ

@DartCZ DartCZ commented Jun 28, 2026

Copy link
Copy Markdown

Summary

Respect the ticks-per.autosave setting on server shutdown. When autosave is
disabled (ticks-per.autosave <= 0), Paper no longer writes world chunks to
disk during stopServer() it only closes the chunk system cleanly. When
autosave is enabled (> 0), behaviour is unchanged: worlds are saved on stop
exactly as before.

Motivation

Currently ticks-per.autosave <= 0 disables periodic autosaving, but the
server still performs a full world save on shutdown, so the setting does not
actually guarantee a non-persistent world.

This is most useful for minigame / lobby servers whose main world is meant
to be ephemeral: the map is reset from a template on every boot, so persisting
player-made changes on shutdown is undesirable (and a waste of disk I/O on large
voided worlds). With this change, setting ticks-per.autosave to 0/-1 makes
the world truly read-only across restarts, without resorting to plugins that
force-unload or wipe regions.

The boundary (> 0 saves, <= 0 skips) matches the existing convention already
used elsewhere in the server:

  • MinecraftServer#tickServer - fullSave = this.autosavePeriod > 0 && ...
  • CraftServer#checkSaveState - treats autosavePeriod <= 0 as disabled.

Scope / notes

  • This only gates chunk saving. Global level metadata (level.dat,
    scoreboard, saved data via saveGlobalData) and player data are still saved
    on stop, as before. Gating those is intentionally out of scope. (Extra option for this in the future?)
  • Also removes an adjacent dead while (false && ...) block left over from the
    chunk-system rewrite, since the surrounding code was already being touched.

@DartCZ DartCZ requested a review from a team as a code owner June 28, 2026 17:47
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Jun 28, 2026
@Warriorrrr

Copy link
Copy Markdown
Member

Disabling autosaving should not disable world saving entirely

@DartCZ

DartCZ commented Jun 28, 2026

Copy link
Copy Markdown
Author

Disabling autosaving should not disable world saving entirely

Agree and to clarify, this PR doesn't disable world saving entirely.
Explicit saves are completely unaffected:

  • /save-all calls saveEverything(..., force = true), which ignores the
    noSave flag, so it always writes , even with autosave disabled.
  • World.save() / plugin-triggered saves go through the same force path.

@Toffikk Toffikk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these changes should be merged into source/respective patches

@github-project-automation github-project-automation Bot moved this from Awaiting review to Changes required in Paper PR Queue Jun 28, 2026
@DartCZ DartCZ force-pushed the feature/skip-world-save-on-shutdown branch from 7d10f66 to 09ce1eb Compare June 28, 2026 19:05
@DartCZ

DartCZ commented Jun 28, 2026

Copy link
Copy Markdown
Author

these changes should be merged into source/respective patches

Done ✅

@DartCZ DartCZ requested a review from Toffikk June 28, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Changes required

Development

Successfully merging this pull request may close these issues.

3 participants