diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-12-18 19:17:17 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-12-18 19:17:17 +0100 |
commit | 26632bbb8a14ce0c258d812171728c55fb78ede8 (patch) | |
tree | 6eb6e37a129f93a27cd97cdd9204cfae9213d251 /src | |
parent | Merge pull request #440 from mc-server/repeaterfixes (diff) | |
download | cuberite-26632bbb8a14ce0c258d812171728c55fb78ede8.tar cuberite-26632bbb8a14ce0c258d812171728c55fb78ede8.tar.gz cuberite-26632bbb8a14ce0c258d812171728c55fb78ede8.tar.bz2 cuberite-26632bbb8a14ce0c258d812171728c55fb78ede8.tar.lz cuberite-26632bbb8a14ce0c258d812171728c55fb78ede8.tar.xz cuberite-26632bbb8a14ce0c258d812171728c55fb78ede8.tar.zst cuberite-26632bbb8a14ce0c258d812171728c55fb78ede8.zip |
Diffstat (limited to '')
-rw-r--r-- | src/ClientHandle.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 9565fc41f..c72240ab5 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1216,12 +1216,13 @@ void cClientHandle::HandleRespawn(void) void cClientHandle::HandleDisconnect(const AString & a_Reason) { - LOGD("Received d/c packet from \"%s\" with reason \"%s\"", m_Username.c_str(), a_Reason.c_str()); + LOGD("Received d/c packet from %s with reason \"%s\"", m_Username.c_str(), a_Reason.c_str()); if (!cRoot::Get()->GetPluginManager()->CallHookDisconnect(m_Player, a_Reason)) { AString DisconnectMessage; - Printf(DisconnectMessage, "%s disconnected: %s", m_Username.c_str(), a_Reason.c_str()); - m_Player->GetWorld()->BroadcastChat(DisconnectMessage, this); + Printf(DisconnectMessage, "%s[LEAVE] %s%s has left the game", cChatColor::Yellow.c_str(), cChatColor::White.c_str(), m_Username.c_str()); + cRoot::Get()->BroadcastChat(DisconnectMessage); + LOGINFO("Player %s has left the game.", m_Username.c_str()); } m_HasSentDC = true; Destroy(); @@ -2287,7 +2288,16 @@ void cClientHandle::SocketClosed(void) { // The socket has been closed for any reason - LOGD("Client \"%s\" @ %s disconnected", m_Username.c_str(), m_IPString.c_str()); + LOGD("Player %s @ %s disconnected", m_Username.c_str(), m_IPString.c_str()); + + if (!cRoot::Get()->GetPluginManager()->CallHookDisconnect(m_Player, "Player disconnected")) + { + AString DisconnectMessage; + Printf(DisconnectMessage, "%s[LEAVE] %s%s has left the game", cChatColor::Yellow.c_str(), cChatColor::White.c_str(), m_Username.c_str()); + cRoot::Get()->BroadcastChat(DisconnectMessage); + LOGINFO("Player %s has left the game.", m_Username.c_str()); + } + Destroy(); } |