diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-07-18 19:57:23 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2020-07-18 20:23:10 +0200 |
commit | 5141d05ba676df9584831ffa9ff6e8ff8905887d (patch) | |
tree | 34a516e598fb0aeece8d728ad8f978d3d00fd0d0 /src/Protocol/Protocol_1_8.cpp | |
parent | 1.13 items support (diff) | |
download | cuberite-5141d05ba676df9584831ffa9ff6e8ff8905887d.tar cuberite-5141d05ba676df9584831ffa9ff6e8ff8905887d.tar.gz cuberite-5141d05ba676df9584831ffa9ff6e8ff8905887d.tar.bz2 cuberite-5141d05ba676df9584831ffa9ff6e8ff8905887d.tar.lz cuberite-5141d05ba676df9584831ffa9ff6e8ff8905887d.tar.xz cuberite-5141d05ba676df9584831ffa9ff6e8ff8905887d.tar.zst cuberite-5141d05ba676df9584831ffa9ff6e8ff8905887d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Protocol_1_8.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index a01fb0424..1c2792461 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -2159,6 +2159,15 @@ UInt32 cProtocol_1_8_0::GetPacketID(ePacketType a_PacketType) +cProtocol::Version cProtocol_1_8_0::GetProtocolVersion() +{ + return Version::Version_1_8_0; +} + + + + + bool cProtocol_1_8_0::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) { switch (m_State) @@ -2270,8 +2279,9 @@ void cProtocol_1_8_0::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) // Version: Json::Value Version; - Version["name"] = "Cuberite 1.8"; - Version["protocol"] = 47; + const auto ProtocolVersion = GetProtocolVersion(); + Version["name"] = "Cuberite " + cMultiVersionProtocol::GetVersionTextFromInt(ProtocolVersion); + Version["protocol"] = static_cast<std::underlying_type_t<cProtocol::Version>>(ProtocolVersion); // Players: Json::Value Players; @@ -2294,10 +2304,9 @@ void cProtocol_1_8_0::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str()); } - auto Response = JsonUtils::WriteFastString(ResponseValue); - + // Serialize the response into a packet: cPacketizer Pkt(*this, pktStatusResponse); - Pkt.WriteString(Response); + Pkt.WriteString(JsonUtils::WriteFastString(ResponseValue)); } |