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 | |
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 'src/Protocol')
-rw-r--r-- | src/Protocol/Protocol.h | 6 | ||||
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 56 | ||||
-rw-r--r-- | src/Protocol/Protocol17x.h | 6 | ||||
-rw-r--r-- | src/Protocol/Protocol18x.cpp | 60 | ||||
-rw-r--r-- | src/Protocol/Protocol18x.h | 6 | ||||
-rw-r--r-- | src/Protocol/ProtocolRecognizer.cpp | 60 | ||||
-rw-r--r-- | src/Protocol/ProtocolRecognizer.h | 6 |
7 files changed, 196 insertions, 4 deletions
diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h index 7be72014a..1a19249bf 100644 --- a/src/Protocol/Protocol.h +++ b/src/Protocol/Protocol.h @@ -70,6 +70,12 @@ public: virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) = 0; virtual void SendChat (const AString & a_Message) = 0; virtual void SendChat (const cCompositeChat & a_Message) = 0; + virtual void SendChatAboveActionBar (const AString & a_Message) = 0; + virtual void SendChatAboveActionBar (const cCompositeChat & a_Message) = 0; + virtual void SendChatSystem (const AString & a_Message) = 0; + virtual void SendChatSystem (const cCompositeChat & a_Message) = 0; + virtual void SendChatType (const AString & a_Message, eChatType type) = 0; + virtual void SendChatType (const cCompositeChat & a_Message, eChatType type) = 0; virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) = 0; virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) = 0; virtual void SendDestroyEntity (const cEntity & a_Entity) = 0; diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 6aa36e2a5..71c68c071 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -247,6 +247,60 @@ void cProtocol172::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockV void cProtocol172::SendChat(const AString & a_Message) { + this->SendChatType(a_Message, ctChatBox); +} + + + + + +void cProtocol172::SendChat(const cCompositeChat & a_Message) +{ + this->SendChatType(a_Message, ctChatBox); +} + + + + + +void cProtocol172::SendChatSystem(const AString & a_Message) +{ + this->SendChatType(a_Message, ctSystem); +} + + + + + +void cProtocol172::SendChatSystem(const cCompositeChat & a_Message) +{ + this->SendChatType(a_Message, ctSystem); +} + + + + + +void cProtocol172::SendChatAboveActionBar(const AString & a_Message) +{ + this->SendChatType(a_Message, ctAboveActionBar); +} + + + + + +void cProtocol172::SendChatAboveActionBar(const cCompositeChat & a_Message) +{ + this->SendChatType(a_Message, ctAboveActionBar); +} + + + + + +void cProtocol172::SendChatType(const AString & a_Message, eChatType type) +{ ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, 0x02); // Chat Message packet @@ -257,7 +311,7 @@ void cProtocol172::SendChat(const AString & a_Message) -void cProtocol172::SendChat(const cCompositeChat & a_Message) +void cProtocol172::SendChatType(const cCompositeChat & a_Message, eChatType type) { ASSERT(m_State == 3); // In game mode? diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h index ead2935b0..b07fa9ed9 100644 --- a/src/Protocol/Protocol17x.h +++ b/src/Protocol/Protocol17x.h @@ -68,6 +68,12 @@ public: virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override; virtual void SendChat (const AString & a_Message) override; virtual void SendChat (const cCompositeChat & a_Message) override; + virtual void SendChatAboveActionBar (const AString & a_Message) override; + virtual void SendChatAboveActionBar (const cCompositeChat & a_Message) override; + virtual void SendChatSystem (const AString & a_Message) override; + virtual void SendChatSystem (const cCompositeChat & a_Message) override; + virtual void SendChatType (const AString & a_Message, eChatType type) override; + virtual void SendChatType (const cCompositeChat & a_Message, eChatType type) override; virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override; virtual void SendDestroyEntity (const cEntity & a_Entity) override; 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); } diff --git a/src/Protocol/Protocol18x.h b/src/Protocol/Protocol18x.h index 6143e8b4e..36ed251fe 100644 --- a/src/Protocol/Protocol18x.h +++ b/src/Protocol/Protocol18x.h @@ -67,6 +67,12 @@ public: virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override; virtual void SendChat (const AString & a_Message) override; virtual void SendChat (const cCompositeChat & a_Message) override; + virtual void SendChatAboveActionBar (const AString & a_Message) override; + virtual void SendChatAboveActionBar (const cCompositeChat & a_Message) override; + virtual void SendChatSystem (const AString & a_Message) override; + virtual void SendChatSystem (const cCompositeChat & a_Message) override; + virtual void SendChatType (const AString & a_Message, eChatType type) override; + virtual void SendChatType (const cCompositeChat & a_Message, eChatType type) override; virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override; virtual void SendDestroyEntity (const cEntity & a_Entity) override; diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp index 477f2d71e..c89c745a4 100644 --- a/src/Protocol/ProtocolRecognizer.cpp +++ b/src/Protocol/ProtocolRecognizer.cpp @@ -158,6 +158,66 @@ void cProtocolRecognizer::SendChat(const cCompositeChat & a_Message) +void cProtocolRecognizer::SendChatAboveActionBar(const AString & a_Message) +{ + ASSERT(m_Protocol != nullptr); + m_Protocol->SendChatAboveActionBar(a_Message); +} + + + + + +void cProtocolRecognizer::SendChatAboveActionBar(const cCompositeChat & a_Message) +{ + ASSERT(m_Protocol != nullptr); + m_Protocol->SendChatAboveActionBar(a_Message); +} + + + + + +void cProtocolRecognizer::SendChatSystem(const AString & a_Message) +{ + ASSERT(m_Protocol != nullptr); + m_Protocol->SendChatSystem(a_Message); +} + + + + + +void cProtocolRecognizer::SendChatSystem(const cCompositeChat & a_Message) +{ + ASSERT(m_Protocol != nullptr); + m_Protocol->SendChatSystem(a_Message); +} + + + + + +void cProtocolRecognizer::SendChatType(const AString & a_Message, eChatType type) +{ + ASSERT(m_Protocol != nullptr); + m_Protocol->SendChatType(a_Message, type); +} + + + + + +void cProtocolRecognizer::SendChatType(const cCompositeChat & a_Message, eChatType type) +{ + ASSERT(m_Protocol != nullptr); + m_Protocol->SendChatType(a_Message, type); +} + + + + + void cProtocolRecognizer::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) { ASSERT(m_Protocol != nullptr); diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h index 956b5dcc0..29eddcbc9 100644 --- a/src/Protocol/ProtocolRecognizer.h +++ b/src/Protocol/ProtocolRecognizer.h @@ -55,6 +55,12 @@ public: virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override; virtual void SendChat (const AString & a_Message) override; virtual void SendChat (const cCompositeChat & a_Message) override; + virtual void SendChatAboveActionBar (const AString & a_Message) override; + virtual void SendChatAboveActionBar (const cCompositeChat & a_Message) override; + virtual void SendChatSystem (const AString & a_Message) override; + virtual void SendChatSystem (const cCompositeChat & a_Message) override; + virtual void SendChatType (const AString & a_Message, eChatType type) override; + virtual void SendChatType (const cCompositeChat & a_Message, eChatType type) override; virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override; virtual void SendDestroyEntity (const cEntity & a_Entity) override; |