Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save after the last player disconnects from vanilla server #3981

Draft
wants to merge 1 commit into
base: 1.4.4
Choose a base branch
from

Conversation

green-new
Copy link

What is the bug?

This fix references issue #3773. When the last player leaves a server, the world does not automatically save, meaning within that time frame data loss is possible.

How did you fix the bug?

I fixed the bug by making a check to see if there are any players in the server after the update in the main loop. If there are no players after the update was made (updates are only executed when there is at least 1 player in the server) then the server will save the world.

Are there alternatives to your fix?

You could make the check further down in the update execution (within the Update(...) method itself or deeper) after the call to HasClients = false; happens and then run the world save. I think the option presented in this pull request is fine, but it could clutter the main loop in the future.

We should also wait to see if there is any more information on this dedicated server functionality before considering merging or consider alternatives like a mod for this feature.

@green-new green-new changed the title Initial commit Save after the last player disconnects from vanilla server Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant