MCPcopy Create free account
hub / github.com/cuberite/cuberite / HandleChat

Method HandleChat

src/ClientHandle.cpp:1159–1185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1157
1158
1159void cClientHandle::HandleChat(const AString & a_Message)
1160{
1161 // We no longer need to postpone message processing, because the messages already arrive in the Tick thread
1162
1163 // If a command, perform it:
1164 AString Message(a_Message);
1165 if (cRoot::Get()->GetServer()->Command(*this, Message))
1166 {
1167 return;
1168 }
1169
1170 // Not a command, broadcast as a message:
1171 cCompositeChat Msg;
1172 AString Color = m_Player->GetColor();
1173 if (Color.length() == 3)
1174 {
1175 Color = AString("@") + Color[2];
1176 }
1177 else
1178 {
1179 Color.empty();
1180 }
1181 Msg.AddTextPart(AString("<") + m_Player->GetName() + "> ", Color);
1182 Msg.ParseText(a_Message);
1183 Msg.UnderlineUrls();
1184 m_Player->GetWorld()->BroadcastChat(Msg);
1185}
1186
1187
1188

Callers 2

ParseChatMethod · 0.80

Calls 10

GetServerMethod · 0.80
GetColorMethod · 0.80
emptyMethod · 0.80
AddTextPartMethod · 0.80
ParseTextMethod · 0.80
UnderlineUrlsMethod · 0.80
CommandMethod · 0.45
GetNameMethod · 0.45
BroadcastChatMethod · 0.45
GetWorldMethod · 0.45

Tested by

no test coverage detected