summaryrefslogtreecommitdiffstats
path: root/src/Protocol
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-09-25 20:45:54 +0200
committerMattes D <github@xoft.cz>2014-09-25 20:45:54 +0200
commite751f4ffe3856134f4a8c49be31c41b94815322f (patch)
tree361d520144c3cb7a9e6fa37da6ee4ae65afcbd6b /src/Protocol
parentProtocol 1.8: Handling packet compression properly. (diff)
parentComment style (diff)
downloadcuberite-e751f4ffe3856134f4a8c49be31c41b94815322f.tar
cuberite-e751f4ffe3856134f4a8c49be31c41b94815322f.tar.gz
cuberite-e751f4ffe3856134f4a8c49be31c41b94815322f.tar.bz2
cuberite-e751f4ffe3856134f4a8c49be31c41b94815322f.tar.lz
cuberite-e751f4ffe3856134f4a8c49be31c41b94815322f.tar.xz
cuberite-e751f4ffe3856134f4a8c49be31c41b94815322f.tar.zst
cuberite-e751f4ffe3856134f4a8c49be31c41b94815322f.zip
Diffstat (limited to 'src/Protocol')
-rw-r--r--src/Protocol/Protocol18x.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp
index 8a9c492ff..3e1863f97 100644
--- a/src/Protocol/Protocol18x.cpp
+++ b/src/Protocol/Protocol18x.cpp
@@ -1391,13 +1391,18 @@ void cProtocol180::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity)
void cProtocol180::SendUpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4)
{
ASSERT(m_State == 3); // In game mode?
-
+
cPacketizer Pkt(*this, 0x33);
Pkt.WritePosition(a_BlockX, a_BlockY, a_BlockZ);
- Pkt.WriteString(Printf("{\"text\": \"%s\"}", a_Line1.c_str()));
- Pkt.WriteString(Printf("{\"text\": \"%s\"}", a_Line2.c_str()));
- Pkt.WriteString(Printf("{\"text\": \"%s\"}", a_Line3.c_str()));
- Pkt.WriteString(Printf("{\"text\": \"%s\"}", a_Line4.c_str()));
+
+ Json::StyledWriter JsonWriter;
+ AString Lines[] = { a_Line1, a_Line2, a_Line3, a_Line4 };
+ for (size_t i = 0; i < ARRAYCOUNT(Lines); i++)
+ {
+ Json::Value RootValue;
+ RootValue["text"] = Lines[i];
+ Pkt.WriteString(JsonWriter.write(RootValue).c_str());
+ }
}