diff options
author | jan64 <jan64.email@gmail.com> | 2015-06-02 19:59:46 +0200 |
---|---|---|
committer | jan64 <jan64.email@gmail.com> | 2015-06-02 19:59:46 +0200 |
commit | d37e0eb72b12cd47863bdca78a790a3f6193d863 (patch) | |
tree | 4036b4b29e577b4886ab2d77d7f2b9bc601b7091 /src/Protocol/Protocol18x.cpp | |
parent | Merge pull request #2182 from birkett/master (diff) | |
download | cuberite-d37e0eb72b12cd47863bdca78a790a3f6193d863.tar cuberite-d37e0eb72b12cd47863bdca78a790a3f6193d863.tar.gz cuberite-d37e0eb72b12cd47863bdca78a790a3f6193d863.tar.bz2 cuberite-d37e0eb72b12cd47863bdca78a790a3f6193d863.tar.lz cuberite-d37e0eb72b12cd47863bdca78a790a3f6193d863.tar.xz cuberite-d37e0eb72b12cd47863bdca78a790a3f6193d863.tar.zst cuberite-d37e0eb72b12cd47863bdca78a790a3f6193d863.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Protocol18x.cpp | 60 |
1 files changed, 57 insertions, 3 deletions
diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp index d06022ce0..d9449283b 100644 --- a/src/Protocol/Protocol18x.cpp +++ b/src/Protocol/Protocol18x.cpp @@ -234,18 +234,72 @@ void cProtocol180::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockV void cProtocol180::SendChat(const AString & a_Message) { + this->SendChatType(a_Message, ctChatBox); +} + + + + + +void cProtocol180::SendChat(const cCompositeChat & a_Message) +{ + this->SendChatType(a_Message, ctChatBox); +} + + + + + +void cProtocol180::SendChatSystem(const AString & a_Message) +{ + this->SendChatType(a_Message, ctSystem); +} + + + + + +void cProtocol180::SendChatSystem(const cCompositeChat & a_Message) +{ + this->SendChatType(a_Message, ctSystem); +} + + + + + +void cProtocol180::SendChatAboveActionBar(const AString & a_Message) +{ + this->SendChatType(a_Message, ctAboveActionBar); +} + + + + + +void cProtocol180::SendChatAboveActionBar(const cCompositeChat & a_Message) +{ + this->SendChatType(a_Message, ctAboveActionBar); +} + + + + + +void cProtocol180::SendChatType(const AString & a_Message, eChatType type) +{ ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, 0x02); // Chat Message packet Pkt.WriteString(Printf("{\"text\":\"%s\"}", EscapeString(a_Message).c_str())); - Pkt.WriteBEInt8(0); + Pkt.WriteBEInt8(type); } -void cProtocol180::SendChat(const cCompositeChat & a_Message) +void cProtocol180::SendChatType(const cCompositeChat & a_Message, eChatType type) { ASSERT(m_State == 3); // In game mode? @@ -255,7 +309,7 @@ void cProtocol180::SendChat(const cCompositeChat & a_Message) // Send the message to the client: cPacketizer Pkt(*this, 0x02); Pkt.WriteString(a_Message.CreateJsonString(ShouldUseChatPrefixes)); - Pkt.WriteBEInt8(0); + Pkt.WriteBEInt8(type); } |