summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol17x.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-04-14 22:52:59 +0200
committermadmaxoft <github@xoft.cz>2014-04-14 22:52:59 +0200
commitd12d7b671523f79f760403f3f4c0ef4efb497c79 (patch)
tree7fe960574b01b1bc1b76327a3f163fd2f69d06ce /src/Protocol/Protocol17x.cpp
parentA client UUID is generated when the server is in offline mode. (diff)
downloadcuberite-d12d7b671523f79f760403f3f4c0ef4efb497c79.tar
cuberite-d12d7b671523f79f760403f3f4c0ef4efb497c79.tar.gz
cuberite-d12d7b671523f79f760403f3f4c0ef4efb497c79.tar.bz2
cuberite-d12d7b671523f79f760403f3f4c0ef4efb497c79.tar.lz
cuberite-d12d7b671523f79f760403f3f4c0ef4efb497c79.tar.xz
cuberite-d12d7b671523f79f760403f3f4c0ef4efb497c79.tar.zst
cuberite-d12d7b671523f79f760403f3f4c0ef4efb497c79.zip
Diffstat (limited to '')
-rw-r--r--src/Protocol/Protocol17x.cpp62
1 files changed, 40 insertions, 22 deletions
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index b44c9f919..c8105c03a 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -574,6 +574,21 @@ void cProtocol172::SendLogin(const cPlayer & a_Player, const cWorld & a_World)
+void cProtocol172::SendLoginSuccess(void)
+{
+ ASSERT(m_State == 2); // State: login?
+
+ cPacketizer Pkt(*this, 0x02); // Login success packet
+ Pkt.WriteString(m_Client->GetUUID());
+ Pkt.WriteString(m_Client->GetUsername());
+
+ m_State = 3; // State = Game
+}
+
+
+
+
+
void cProtocol172::SendPaintingSpawn(const cPainting & a_Painting)
{
cPacketizer Pkt(*this, 0x10); // Spawn Painting packet
@@ -1556,18 +1571,7 @@ void cProtocol172::HandlePacketLoginEncryptionResponse(cByteBuffer & a_ByteBuffe
}
StartEncryption(DecryptedKey);
-
- /*
- // Send login success:
- {
- cPacketizer Pkt(*this, 0x02); // Login success packet
- Pkt.WriteString(m_Client->GetUUID());
- Pkt.WriteString(m_Client->GetUsername());
- }
-
- m_State = 3; // State = Game
m_Client->HandleLogin(4, m_Client->GetUsername());
- */
}
@@ -1599,17 +1603,6 @@ void cProtocol172::HandlePacketLoginStart(cByteBuffer & a_ByteBuffer)
return;
}
- // Generate an offline UUID for the player:
- m_Client->GenerateOfflineUUID();
-
- // Send login success:
- {
- cPacketizer Pkt(*this, 0x02); // Login success packet
- Pkt.WriteString(m_Client->GetUUID());
- Pkt.WriteString(Username);
- }
-
- m_State = 3; // State = Game
m_Client->HandleLogin(4, Username);
}
@@ -2797,3 +2790,28 @@ void cProtocol176::SendPlayerSpawn(const cPlayer & a_Player)
+
+void cProtocol176::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
+{
+ // Send the response:
+ AString Response = "{\"version\":{\"name\":\"1.7.6\",\"protocol\":5},\"players\":{";
+ AppendPrintf(Response, "\"max\":%u,\"online\":%u,\"sample\":[]},",
+ cRoot::Get()->GetServer()->GetMaxPlayers(),
+ cRoot::Get()->GetServer()->GetNumPlayers()
+ );
+ AppendPrintf(Response, "\"description\":{\"text\":\"%s\"},",
+ cRoot::Get()->GetServer()->GetDescription().c_str()
+ );
+ AppendPrintf(Response, "\"favicon\":\"data:image/png;base64,%s\"",
+ cRoot::Get()->GetServer()->GetFaviconData().c_str()
+ );
+ Response.append("}");
+
+ cPacketizer Pkt(*this, 0x00); // Response packet
+ Pkt.WriteString(Response);
+}
+
+
+
+
+