summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2020-09-21 14:12:09 +0200
committerGitHub <noreply@github.com>2020-09-21 14:12:09 +0200
commit8de71fc9d6f2226e84074e941139ca0a8f1e6b0f (patch)
treeaaf16294e18fd032c46bd4f38ecb85060fa0ac42 /src
parentImplement fortune for ores, glowstone and sea lanterns (#4897) (diff)
downloadcuberite-8de71fc9d6f2226e84074e941139ca0a8f1e6b0f.tar
cuberite-8de71fc9d6f2226e84074e941139ca0a8f1e6b0f.tar.gz
cuberite-8de71fc9d6f2226e84074e941139ca0a8f1e6b0f.tar.bz2
cuberite-8de71fc9d6f2226e84074e941139ca0a8f1e6b0f.tar.lz
cuberite-8de71fc9d6f2226e84074e941139ca0a8f1e6b0f.tar.xz
cuberite-8de71fc9d6f2226e84074e941139ca0a8f1e6b0f.tar.zst
cuberite-8de71fc9d6f2226e84074e941139ca0a8f1e6b0f.zip
Diffstat (limited to 'src')
-rw-r--r--src/Root.cpp12
-rw-r--r--src/Root.h3
-rw-r--r--src/Server.cpp3
3 files changed, 17 insertions, 1 deletions
diff --git a/src/Root.cpp b/src/Root.cpp
index b90a229c9..b3712a687 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -577,6 +577,18 @@ void cRoot::SaveAllChunks(void)
+void cRoot::SaveAllChunksNow(void)
+{
+ for (auto & Entry : m_WorldsByName)
+ {
+ Entry.second.SaveAllChunks();
+ }
+}
+
+
+
+
+
void cRoot::SetSavingEnabled(bool a_SavingEnabled)
{
for (auto & Entry : m_WorldsByName)
diff --git a/src/Root.h b/src/Root.h
index 1f5354c71..6ec8e5481 100644
--- a/src/Root.h
+++ b/src/Root.h
@@ -140,6 +140,9 @@ public:
/** Saves all chunks in all worlds */
void SaveAllChunks(void); // tolua_export
+ /** Saves all chunks in all worlds synchronously (waits until dirty chunks have been sent to the ChunkStorage queue before returning) */
+ void SaveAllChunksNow(void);
+
/** Sets whether saving chunks is enabled in all worlds (overrides however the worlds were already set) */
void SetSavingEnabled(bool a_SavingEnabled); // tolua_export
diff --git a/src/Server.cpp b/src/Server.cpp
index a1dedf333..67629ef2c 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -648,7 +648,8 @@ void cServer::Shutdown(void)
// Notify the tick thread and wait for it to terminate:
m_TickThread.Stop();
- cRoot::Get()->SaveAllChunks();
+ // Save all chunks in all worlds, wait for chunks to be sent to the ChunkStorage queue for each world:
+ cRoot::Get()->SaveAllChunksNow();
// Remove all clients:
cCSLock Lock(m_CSClients);