PaperMC / PaperMC/Paper

World#setAutoSave(false) does not disable incremental save completely

Open
#9,800 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: needs triage type: bug
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior

If I call the method World#setAutoSave(boolean) with false as parameter, I would expect to disable the saving of the world as a whole, but in net.minecraft.server.MinecraftServer#tickServer(BooleanSupplier) is only an if-check respecting the paper level configuration.

The AutoSave-Property is still considered in the process but only a few instructions later and only for the chunk map. Some other world data, which is still accessing the world file, will still be saved.

There would be two possible solutions to fix that:
(i) Move the if-check in net.minecraft.server.level.ServerLevel#saveIncrementally(boolean) into the if-clause in the MinecraftServer where the paper configuration is checked. As the saveIncrementally-Method is only called there, it would not break anything else (besides plugins that call the method using NMS).
(ii) Add the if-check into the if-clause of the MinecraftServer where the paper configuration is checked and additionally keep the check in the saveIncrementally-Method in ServerLevel to not break anything that calls the method using NMS.

In the end, the change could still break some plugins that depend on the partial save despite setting the autosave to false. But personally, I expect the world to not save at all if I disable the autosave.

Observed/Actual behavior

After setting the AutoSave of a world to false, the WorldSaveEvent is still called and some world data is still being saved into the world file.

Steps/models to reproduce

Set the World#setAutoSave(boolean) to false and wait 😄 (Edit: You should be able to track the save via WorldSaveEvent)

Plugin and Datapack List

doesn't matter

Paper version

Commit-Reference: d6d2b6f4e51b24867b609cf747ac6d8c6345c449

Other

If this "request" gets approved, I am more than happy to hand in the PR :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect net.minecraft.server.MinecraftServer#tickServer(BooleanSupplier) and net.minecraft.server.level.ServerLevel#saveIncrementally(boolean), then reproduce with World#setAutoSave(false) while tracking WorldSaveEvent. Determine which save paths still run and verify that disabling autosave prevents the reported world data saves without unnecessarily breaking callers of the ServerLevel method.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.