summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol125.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-02-15 23:16:44 +0100
committermadmaxoft <github@xoft.cz>2014-02-15 23:17:49 +0100
commit0f1f7583aeea65335b2ee051585a857b1142a927 (patch)
treed87a4a6c92ea5f144327d2e88d5bd5845cd668e8 /src/Protocol/Protocol125.cpp
parentMerge pull request #679 from mc-server/NotchDeath (diff)
downloadcuberite-0f1f7583aeea65335b2ee051585a857b1142a927.tar
cuberite-0f1f7583aeea65335b2ee051585a857b1142a927.tar.gz
cuberite-0f1f7583aeea65335b2ee051585a857b1142a927.tar.bz2
cuberite-0f1f7583aeea65335b2ee051585a857b1142a927.tar.lz
cuberite-0f1f7583aeea65335b2ee051585a857b1142a927.tar.xz
cuberite-0f1f7583aeea65335b2ee051585a857b1142a927.tar.zst
cuberite-0f1f7583aeea65335b2ee051585a857b1142a927.zip
Diffstat (limited to 'src/Protocol/Protocol125.cpp')
-rw-r--r--src/Protocol/Protocol125.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/Protocol/Protocol125.cpp b/src/Protocol/Protocol125.cpp
index 73d21161c..7020699d1 100644
--- a/src/Protocol/Protocol125.cpp
+++ b/src/Protocol/Protocol125.cpp
@@ -32,6 +32,8 @@ Documentation:
#include "../Mobs/IncludeAllMonsters.h"
+#include "../CompositeChat.h"
+
@@ -233,6 +235,42 @@ void cProtocol125::SendChat(const AString & a_Message)
+void cProtocol125::SendChat(const cCompositeChat & a_Message)
+{
+ // This version doesn't support composite messages, just extract each part's text and use it:
+ AString Msg;
+ const cCompositeChat::cParts & Parts = a_Message.GetParts();
+ for (cCompositeChat::cParts::const_iterator itr = Parts.begin(), end = Parts.end(); itr != end; ++itr)
+ {
+ switch ((*itr)->m_PartType)
+ {
+ case cCompositeChat::ptText:
+ case cCompositeChat::ptClientTranslated:
+ case cCompositeChat::ptRunCommand:
+ case cCompositeChat::ptSuggestCommand:
+ {
+ Msg.append((*itr)->m_Text);
+ break;
+ }
+ case cCompositeChat::ptUrl:
+ {
+ Msg.append(((cCompositeChat::cUrlPart *)(*itr))->m_Url);
+ break;
+ }
+ } // switch (PartType)
+ } // for itr - Parts[]
+
+ // Send the message:
+ cCSLock Lock(m_CSPacket);
+ WriteByte (PACKET_CHAT);
+ WriteString(Msg);
+ Flush();
+}
+
+
+
+
+
void cProtocol125::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer)
{
cCSLock Lock(m_CSPacket);