diff options
author | sweetgiorni <sweet.giorni@gmail.com> | 2017-01-03 21:26:58 +0100 |
---|---|---|
committer | sweetgiorni <sweet.giorni@gmail.com> | 2017-01-03 21:31:07 +0100 |
commit | 0718d82e1a5a6fdfe9346f801fa008f2b37cf69d (patch) | |
tree | dbfc88b68aad22d2a0254ff8988683a4107c10c8 /src/Root.cpp | |
parent | Api Documentation (diff) | |
download | cuberite-0718d82e1a5a6fdfe9346f801fa008f2b37cf69d.tar cuberite-0718d82e1a5a6fdfe9346f801fa008f2b37cf69d.tar.gz cuberite-0718d82e1a5a6fdfe9346f801fa008f2b37cf69d.tar.bz2 cuberite-0718d82e1a5a6fdfe9346f801fa008f2b37cf69d.tar.lz cuberite-0718d82e1a5a6fdfe9346f801fa008f2b37cf69d.tar.xz cuberite-0718d82e1a5a6fdfe9346f801fa008f2b37cf69d.tar.zst cuberite-0718d82e1a5a6fdfe9346f801fa008f2b37cf69d.zip |
Diffstat (limited to 'src/Root.cpp')
-rw-r--r-- | src/Root.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Root.cpp b/src/Root.cpp index a5567dc9b..80366e5c1 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -343,11 +343,14 @@ void cRoot::StopServer() } public: cPlayerCallback(AString a_ShutdownMessage) : m_ShutdownMessage(a_ShutdownMessage) {} - } PlayerCallback((m_Server->GetShutdownMessage())); + }; - cRoot::Get()->ForEachPlayer(PlayerCallback); - // What's a better way to do this? - std::this_thread::sleep_for(std::chrono::seconds(1)); + if (m_Server->GetNumPlayers()) + { + cPlayerCallback PlayerCallback((m_Server->GetShutdownMessage())); + cRoot::Get()->ForEachPlayer(PlayerCallback); + std::this_thread::sleep_for(std::chrono::seconds(1)); + } m_TerminateEventRaised = true; m_StopEvent.Set(); m_InputThreadRunFlag.clear(); |