summaryrefslogtreecommitdiffstats
path: root/src/Protocol
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-25 18:49:55 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-25 18:49:55 +0200
commit12621e3800ec353bca179243d521580e0da6eae9 (patch)
tree4067b6c7bdb81ce1fe6642308a83cc95c4720902 /src/Protocol
parentFixed dispender direction bug (diff)
downloadcuberite-12621e3800ec353bca179243d521580e0da6eae9.tar
cuberite-12621e3800ec353bca179243d521580e0da6eae9.tar.gz
cuberite-12621e3800ec353bca179243d521580e0da6eae9.tar.bz2
cuberite-12621e3800ec353bca179243d521580e0da6eae9.tar.lz
cuberite-12621e3800ec353bca179243d521580e0da6eae9.tar.xz
cuberite-12621e3800ec353bca179243d521580e0da6eae9.tar.zst
cuberite-12621e3800ec353bca179243d521580e0da6eae9.zip
Diffstat (limited to '')
-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 f62d350fe..a92ab5f54 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());
+ }
}