diff options
Diffstat (limited to 'src/Protocol/Protocol_1_13.cpp')
-rw-r--r-- | src/Protocol/Protocol_1_13.cpp | 53 |
1 files changed, 9 insertions, 44 deletions
diff --git a/src/Protocol/Protocol_1_13.cpp b/src/Protocol/Protocol_1_13.cpp index 74e663f3d..f26b1900a 100644 --- a/src/Protocol/Protocol_1_13.cpp +++ b/src/Protocol/Protocol_1_13.cpp @@ -197,6 +197,15 @@ void cProtocol_1_13::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity) +cProtocol::Version cProtocol_1_13::GetProtocolVersion() +{ + return Version::Version_1_13; +} + + + + + bool cProtocol_1_13::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) { if (m_State != 3) @@ -250,50 +259,6 @@ bool cProtocol_1_13::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketTyp -void cProtocol_1_13::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) -{ - cServer * Server = cRoot::Get()->GetServer(); - AString ServerDescription = Server->GetDescription(); - auto NumPlayers = static_cast<signed>(Server->GetNumPlayers()); - auto MaxPlayers = static_cast<signed>(Server->GetMaxPlayers()); - AString Favicon = Server->GetFaviconData(); - cRoot::Get()->GetPluginManager()->CallHookServerPing(*m_Client, ServerDescription, NumPlayers, MaxPlayers, Favicon); - - // Version: - Json::Value Version; - Version["name"] = "Cuberite 1.13"; - Version["protocol"] = cMultiVersionProtocol::PROTO_VERSION_1_13; - - // Players: - Json::Value Players; - Players["online"] = NumPlayers; - Players["max"] = MaxPlayers; - // TODO: Add "sample" - - // Description: - Json::Value Description; - Description["text"] = ServerDescription.c_str(); - - // Create the response: - Json::Value ResponseValue; - ResponseValue["version"] = Version; - ResponseValue["players"] = Players; - ResponseValue["description"] = Description; - m_Client->ForgeAugmentServerListPing(ResponseValue); - if (!Favicon.empty()) - { - ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str()); - } - - // Serialize the response into a packet: - cPacketizer Pkt(*this, pktStatusResponse); - Pkt.WriteString(JsonUtils::WriteFastString(ResponseValue)); -} - - - - - void cProtocol_1_13::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Channel); |