summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_9.cpp
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2020-05-09 16:51:15 +0200
committerGitHub <noreply@github.com>2020-05-09 16:51:15 +0200
commite6634ed26c50e99f6ccd285235fe477cb4168b06 (patch)
treeb533a69db545835a886bcd8c5b05609b4c830d11 /src/Protocol/Protocol_1_9.cpp
parentUpgrade to C++17 [CI] (#4716) (diff)
downloadcuberite-e6634ed26c50e99f6ccd285235fe477cb4168b06.tar
cuberite-e6634ed26c50e99f6ccd285235fe477cb4168b06.tar.gz
cuberite-e6634ed26c50e99f6ccd285235fe477cb4168b06.tar.bz2
cuberite-e6634ed26c50e99f6ccd285235fe477cb4168b06.tar.lz
cuberite-e6634ed26c50e99f6ccd285235fe477cb4168b06.tar.xz
cuberite-e6634ed26c50e99f6ccd285235fe477cb4168b06.tar.zst
cuberite-e6634ed26c50e99f6ccd285235fe477cb4168b06.zip
Diffstat (limited to 'src/Protocol/Protocol_1_9.cpp')
-rw-r--r--src/Protocol/Protocol_1_9.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp
index ff62df242..49d5e876b 100644
--- a/src/Protocol/Protocol_1_9.cpp
+++ b/src/Protocol/Protocol_1_9.cpp
@@ -27,7 +27,7 @@ Implements the 1.9 protocol classes:
#include "../StringCompression.h"
#include "../CompositeChat.h"
#include "../Statistics.h"
-#include "../World.h"
+#include "../JsonUtils.h"
#include "../WorldStorage/FastNBT.h"
@@ -702,8 +702,7 @@ void cProtocol_1_9_0::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str());
}
- Json::FastWriter Writer;
- AString Response = Writer.write(ResponseValue);
+ auto Response = JsonUtils::WriteFastString(ResponseValue);
cPacketizer Pkt(*this, pktStatusResponse);
Pkt.WriteString(Response);
@@ -2281,8 +2280,7 @@ void cProtocol_1_9_1::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str());
}
- Json::FastWriter Writer;
- AString Response = Writer.write(ResponseValue);
+ AString Response = JsonUtils::WriteFastString(ResponseValue);
cPacketizer Pkt(*this, pktStatusResponse);
Pkt.WriteString(Response);
@@ -2339,8 +2337,7 @@ void cProtocol_1_9_2::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str());
}
- Json::FastWriter Writer;
- AString Response = Writer.write(ResponseValue);
+ AString Response = JsonUtils::WriteFastString(ResponseValue);
cPacketizer Pkt(*this, pktStatusResponse);
Pkt.WriteString(Response);
@@ -2397,8 +2394,7 @@ void cProtocol_1_9_4::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str());
}
- Json::FastWriter Writer;
- AString Response = Writer.write(ResponseValue);
+ AString Response = JsonUtils::WriteFastString(ResponseValue);
cPacketizer Pkt(*this, pktStatusResponse);
Pkt.WriteString(Response);
@@ -2439,19 +2435,18 @@ void cProtocol_1_9_4::SendUpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, c
Writer.AddInt("z", a_BlockZ);
Writer.AddString("id", "Sign");
- Json::StyledWriter JsonWriter;
Json::Value Line1;
Line1["text"] = a_Line1;
- Writer.AddString("Text1", JsonWriter.write(Line1));
+ Writer.AddString("Text1", JsonUtils::WriteFastString(Line1));
Json::Value Line2;
Line2["text"] = a_Line2;
- Writer.AddString("Text2", JsonWriter.write(Line2));
+ Writer.AddString("Text2", JsonUtils::WriteFastString(Line2));
Json::Value Line3;
Line3["text"] = a_Line3;
- Writer.AddString("Text3", JsonWriter.write(Line3));
+ Writer.AddString("Text3", JsonUtils::WriteFastString(Line3));
Json::Value Line4;
Line4["text"] = a_Line4;
- Writer.AddString("Text4", JsonWriter.write(Line4));
+ Writer.AddString("Text4", JsonUtils::WriteFastString(Line4));
Writer.Finish();
Pkt.WriteBuf(Writer.GetResult().data(), Writer.GetResult().size());