summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-05-26 17:01:57 +0200
committerMattes D <github@xoft.cz>2015-05-26 17:01:57 +0200
commit1e297717e0ba5838e3d6b5dbc29de97aab4f1e9e (patch)
treeec6469de181fde60c61bdae320e589e81ddddecd /src
parentMerge pull request #1848 from scottwillmoore/ImplementTitleCommand (diff)
parentFixed ClientHandle not getting properly removed from the world (diff)
downloadcuberite-1e297717e0ba5838e3d6b5dbc29de97aab4f1e9e.tar
cuberite-1e297717e0ba5838e3d6b5dbc29de97aab4f1e9e.tar.gz
cuberite-1e297717e0ba5838e3d6b5dbc29de97aab4f1e9e.tar.bz2
cuberite-1e297717e0ba5838e3d6b5dbc29de97aab4f1e9e.tar.lz
cuberite-1e297717e0ba5838e3d6b5dbc29de97aab4f1e9e.tar.xz
cuberite-1e297717e0ba5838e3d6b5dbc29de97aab4f1e9e.tar.zst
cuberite-1e297717e0ba5838e3d6b5dbc29de97aab4f1e9e.zip
Diffstat (limited to 'src')
-rw-r--r--src/ClientHandle.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 13972b0f5..765ccdee2 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -2957,13 +2957,20 @@ void cClientHandle::PacketError(UInt32 a_PacketType)
void cClientHandle::SocketClosed(void)
{
// The socket has been closed for any reason
-
+
if (!m_Username.empty()) // Ignore client pings
{
LOGD("Client %s @ %s disconnected", m_Username.c_str(), m_IPString.c_str());
cRoot::Get()->GetPluginManager()->CallHookDisconnect(*this, "Player disconnected");
}
-
+ if (m_State < csDestroying)
+ {
+ cWorld * World = m_Player->GetWorld();
+ if (World != nullptr)
+ {
+ World->RemovePlayer(m_Player, true); // Must be called before cPlayer::Destroy() as otherwise cChunk tries to delete the player, and then we do it again
+ }
+ }
Destroy();
}