summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol125.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-18 18:50:17 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-18 18:50:17 +0200
commit43ed690520d3c3b47ed7ff6f48f868e8011565e0 (patch)
tree7db2b1b7dde37f498e6ed09e90a68ae3faff0718 /src/Protocol/Protocol125.cpp
parent1.8: Simplified item metadata reading. (diff)
downloadcuberite-43ed690520d3c3b47ed7ff6f48f868e8011565e0.tar
cuberite-43ed690520d3c3b47ed7ff6f48f868e8011565e0.tar.gz
cuberite-43ed690520d3c3b47ed7ff6f48f868e8011565e0.tar.bz2
cuberite-43ed690520d3c3b47ed7ff6f48f868e8011565e0.tar.lz
cuberite-43ed690520d3c3b47ed7ff6f48f868e8011565e0.tar.xz
cuberite-43ed690520d3c3b47ed7ff6f48f868e8011565e0.tar.zst
cuberite-43ed690520d3c3b47ed7ff6f48f868e8011565e0.zip
Diffstat (limited to 'src/Protocol/Protocol125.cpp')
-rw-r--r--src/Protocol/Protocol125.cpp71
1 files changed, 58 insertions, 13 deletions
diff --git a/src/Protocol/Protocol125.cpp b/src/Protocol/Protocol125.cpp
index c785553a5..4378ef466 100644
--- a/src/Protocol/Protocol125.cpp
+++ b/src/Protocol/Protocol125.cpp
@@ -719,28 +719,73 @@ void cProtocol125::SendPaintingSpawn(const cPainting & a_Painting)
-void cProtocol125::SendPlayerListItem(const cPlayer & a_Player, char a_Action)
+void cProtocol125::SendPlayerListAddPlayer(const cPlayer & a_Player)
{
cCSLock Lock(m_CSPacket);
- if (a_Action == 1)
+ WriteByte (PACKET_PLAYER_LIST_ITEM);
+ WriteString(a_Player.GetName());
+ WriteBool (true);
+ WriteShort (a_Player.GetClientHandle()->GetPing());
+ Flush();
+}
+
+
+
+
+
+void cProtocol125::SendPlayerListRemovePlayer(const cPlayer & a_Player)
+{
+ cCSLock Lock(m_CSPacket);
+ WriteByte (PACKET_PLAYER_LIST_ITEM);
+ WriteString(a_Player.GetName());
+ WriteBool (false);
+ WriteShort (0);
+ Flush();
+}
+
+
+
+
+
+void cProtocol125::SendPlayerListUpdateGameMode(const cPlayer & a_Player)
+{
+ // Not implemented in this protocol version
+ UNUSED(a_Player);
+}
+
+
+
+
+
+void cProtocol125::SendPlayerListUpdatePing(const cPlayer & a_Player)
+{
+ // It is a simple add player packet in this protocol.
+ SendPlayerListAddPlayer(a_Player);
+}
+
+
+
+
+
+void cProtocol125::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName)
+{
+ if (a_OldListName == a_Player.GetName())
{
- // Ignore gamemode update
return;
}
- AString PlayerName(a_Player.GetColor());
- PlayerName.append(a_Player.GetName());
- if (PlayerName.length() > 14)
+ cCSLock Lock(m_CSPacket);
+
+ // Remove the old name from the tablist:
{
- PlayerName.erase(14);
+ WriteByte (PACKET_PLAYER_LIST_ITEM);
+ WriteString(a_OldListName);
+ WriteBool (false);
+ WriteShort (0);
+ Flush();
}
- PlayerName += cChatColor::White;
- WriteByte ((unsigned char)PACKET_PLAYER_LIST_ITEM);
- WriteString(PlayerName);
- WriteBool (a_Action != 4);
- WriteShort ((a_Action == 4) ? 0 : a_Player.GetClientHandle()->GetPing());
- Flush();
+ SendPlayerListAddPlayer(a_Player);
}