summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol17x.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/Protocol17x.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/Protocol17x.cpp')
-rw-r--r--src/Protocol/Protocol17x.cpp66
1 files changed, 59 insertions, 7 deletions
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index f51f15ec2..05935fbe1 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -777,19 +777,71 @@ void cProtocol172::SendParticleEffect(const AString & a_ParticleName, float a_Sr
-void cProtocol172::SendPlayerListItem(const cPlayer & a_Player, char a_Action)
+void cProtocol172::SendPlayerListAddPlayer(const cPlayer & a_Player)
{
ASSERT(m_State == 3); // In game mode?
- if (a_Action == 1)
+
+ cPacketizer Pkt(*this, 0x38); // Playerlist Item packet
+ Pkt.WriteString(a_Player.GetName());
+ Pkt.WriteBool(true);
+ Pkt.WriteShort(a_Player.GetClientHandle()->GetPing());
+}
+
+
+
+
+
+void cProtocol172::SendPlayerListRemovePlayer(const cPlayer & a_Player)
+{
+ ASSERT(m_State == 3); // In game mode?
+
+ cPacketizer Pkt(*this, 0x38);
+ Pkt.WriteString(a_Player.GetName());
+ Pkt.WriteBool(false);
+ Pkt.WriteShort(0);
+}
+
+
+
+
+
+void cProtocol172::SendPlayerListUpdateGameMode(const cPlayer & a_Player)
+{
+ // Not implemented in this protocol version
+ UNUSED(a_Player);
+}
+
+
+
+
+
+void cProtocol172::SendPlayerListUpdatePing(const cPlayer & a_Player)
+{
+ // It is a simple add player packet in this protocol.
+ SendPlayerListAddPlayer(a_Player);
+}
+
+
+
+
+
+void cProtocol172::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName)
+{
+ ASSERT(m_State == 3); // In game mode?
+ if (a_OldListName == a_Player.GetName())
{
- // Ignore gamemode update
return;
}
- cPacketizer Pkt(*this, 0x38); // Playerlist Item packet
- Pkt.WriteString(a_Player.GetName());
- Pkt.WriteBool(a_Action != 4);
- Pkt.WriteShort((a_Action == 4) ? 0 : a_Player.GetClientHandle()->GetPing());
+ // Remove the old name from the tablist:
+ {
+ cPacketizer Pkt(*this, 0x38);
+ Pkt.WriteString(a_OldListName);
+ Pkt.WriteBool(false);
+ Pkt.WriteShort(0);
+ }
+
+ SendPlayerListAddPlayer(a_Player);
}