summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-02-20 14:37:15 +0100
committerandrew <xdotftw@gmail.com>2014-02-20 14:37:15 +0100
commit83d3a2eedf88a3a180b9dfc4c706838d7f99382a (patch)
treed96970727615c681efe3bf76793015cead438394 /src/ClientHandle.cpp
parentcMapDecorator: Implemented random rotations (diff)
parentAPIDump: Fixed cBlockArea:GetRelBlockType() return types. (diff)
downloadcuberite-83d3a2eedf88a3a180b9dfc4c706838d7f99382a.tar
cuberite-83d3a2eedf88a3a180b9dfc4c706838d7f99382a.tar.gz
cuberite-83d3a2eedf88a3a180b9dfc4c706838d7f99382a.tar.bz2
cuberite-83d3a2eedf88a3a180b9dfc4c706838d7f99382a.tar.lz
cuberite-83d3a2eedf88a3a180b9dfc4c706838d7f99382a.tar.xz
cuberite-83d3a2eedf88a3a180b9dfc4c706838d7f99382a.tar.zst
cuberite-83d3a2eedf88a3a180b9dfc4c706838d7f99382a.zip
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp43
1 files changed, 34 insertions, 9 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index efc5a9f64..a6a74bf4a 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -31,6 +31,7 @@
#include "MersenneTwister.h"
#include "Protocol/ProtocolRecognizer.h"
+#include "CompositeChat.h"
@@ -94,6 +95,7 @@ cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance) :
m_ShouldCheckDownloaded(false),
m_NumExplosionsThisTick(0),
m_UniqueID(0),
+ m_Locale("en_GB"),
m_HasSentPlayerChunk(false)
{
m_Protocol = new cProtocolRecognizer(this);
@@ -1087,14 +1089,20 @@ void cClientHandle::HandleChat(const AString & a_Message)
return;
}
- // Not a command, broadcast as a simple message:
- AString Msg;
- Printf(Msg, "%s<%s>%s %s",
- m_Player->GetColor().c_str(),
- m_Player->GetName().c_str(),
- cChatColor::White.c_str(),
- Message.c_str()
- );
+ // Not a command, broadcast as a message:
+ cCompositeChat Msg;
+ AString Color = m_Player->GetColor();
+ if (Color.length() == 3)
+ {
+ Color = AString("@") + Color[2];
+ }
+ else
+ {
+ Color.empty();
+ }
+ Msg.AddTextPart(AString("<") + m_Player->GetName() + "> ", Color);
+ Msg.ParseText(a_Message);
+ Msg.UnderlineUrls();
m_Player->GetWorld()->BroadcastChat(Msg);
}
@@ -1729,7 +1737,7 @@ void cClientHandle::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlock
-void cClientHandle::SendChat(const AString & a_Message, ChatPrefixCodes a_ChatPrefix, const AString & a_AdditionalData)
+void cClientHandle::SendChat(const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData)
{
bool ShouldAppendChatPrefixes = true;
@@ -1840,6 +1848,15 @@ void cClientHandle::SendChat(const AString & a_Message, ChatPrefixCodes a_ChatPr
+void cClientHandle::SendChat(const cCompositeChat & a_Message)
+{
+ m_Protocol->SendChat(a_Message);
+}
+
+
+
+
+
void cClientHandle::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer)
{
ASSERT(m_Player != NULL);
@@ -2101,6 +2118,14 @@ void cClientHandle::SendPickupSpawn(const cPickup & a_Pickup)
+void cClientHandle::SendPaintingSpawn(const cPainting & a_Painting)
+{
+ m_Protocol->SendPaintingSpawn(a_Painting);
+}
+
+
+
+
void cClientHandle::SendEntityAnimation(const cEntity & a_Entity, char a_Animation)
{