diff options
author | madmaxoft <github@xoft.cz> | 2014-01-13 20:32:15 +0100 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-01-13 20:32:15 +0100 |
commit | ada54b79d71fbfc653799b535efd11b466423f75 (patch) | |
tree | 73aa5bbd56ac0a0c3c16b64e341c67a702883b62 /src/Protocol/Protocol17x.cpp | |
parent | ProtoProxy: Fixed login kick packet direction. (diff) | |
download | cuberite-ada54b79d71fbfc653799b535efd11b466423f75.tar cuberite-ada54b79d71fbfc653799b535efd11b466423f75.tar.gz cuberite-ada54b79d71fbfc653799b535efd11b466423f75.tar.bz2 cuberite-ada54b79d71fbfc653799b535efd11b466423f75.tar.lz cuberite-ada54b79d71fbfc653799b535efd11b466423f75.tar.xz cuberite-ada54b79d71fbfc653799b535efd11b466423f75.tar.zst cuberite-ada54b79d71fbfc653799b535efd11b466423f75.zip |
Diffstat (limited to 'src/Protocol/Protocol17x.cpp')
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 9c46c6843..68992155e 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -216,8 +216,23 @@ void cProtocol172::SendDestroyEntity(const cEntity & a_Entity) void cProtocol172::SendDisconnect(const AString & a_Reason) { - cPacketizer Pkt(*this, 0x40); - Pkt.WriteString(Printf("{\"text\":\"%s\"}", EscapeString(a_Reason).c_str())); + switch (m_State) + { + case 2: + { + // During login: + cPacketizer Pkt(*this, 0); + Pkt.WriteString(Printf("{\"text\":\"%s\"}", EscapeString(a_Reason).c_str())); + break; + } + case 3: + { + // In-game: + cPacketizer Pkt(*this, 0x40); + Pkt.WriteString(Printf("{\"text\":\"%s\"}", EscapeString(a_Reason).c_str())); + break; + } + } } @@ -1156,6 +1171,12 @@ void cProtocol172::HandlePacketLoginStart(cByteBuffer & a_ByteBuffer) // TODO: Protocol encryption should be set up here if not localhost / auth + if (!m_Client->HandleHandshake(Username)) + { + // The client is not welcome here, they have been sent a Kick packet already + return; + } + // Send login success: { cPacketizer Pkt(*this, 0x02); // Login success packet |