summaryrefslogtreecommitdiffstats
path: root/src/Protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/Protocol')
-rw-r--r--src/Protocol/Protocol.h2
-rw-r--r--src/Protocol/Protocol125.cpp22
-rw-r--r--src/Protocol/Protocol125.h2
-rw-r--r--src/Protocol/Protocol17x.cpp20
-rw-r--r--src/Protocol/Protocol17x.h2
-rw-r--r--src/Protocol/Protocol18x.cpp21
-rw-r--r--src/Protocol/Protocol18x.h2
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp4
-rw-r--r--src/Protocol/ProtocolRecognizer.h2
9 files changed, 20 insertions, 57 deletions
diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h
index f351ee4b9..b2ee92918 100644
--- a/src/Protocol/Protocol.h
+++ b/src/Protocol/Protocol.h
@@ -98,7 +98,7 @@ public:
virtual void SendPlayerListRemovePlayer (const cPlayer & a_Player) = 0;
virtual void SendPlayerListUpdateGameMode (const cPlayer & a_Player) = 0;
virtual void SendPlayerListUpdatePing (const cPlayer & a_Player) = 0;
- virtual void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName) = 0;
+ virtual void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName) = 0;
virtual void SendPlayerMaxSpeed (void) = 0; ///< Informs the client of the maximum player speed (1.6.1+)
virtual void SendPlayerMoveLook (void) = 0;
virtual void SendPlayerPosition (void) = 0;
diff --git a/src/Protocol/Protocol125.cpp b/src/Protocol/Protocol125.cpp
index ba4cfa7ef..8a5f26c8b 100644
--- a/src/Protocol/Protocol125.cpp
+++ b/src/Protocol/Protocol125.cpp
@@ -767,25 +767,11 @@ void cProtocol125::SendPlayerListUpdatePing(const cPlayer & a_Player)
-void cProtocol125::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName)
+void cProtocol125::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName)
{
- if (a_OldListName == a_Player.GetPlayerListName())
- {
- return;
- }
-
- cCSLock Lock(m_CSPacket);
-
- // Remove the old name from the tablist:
- {
- WriteByte (PACKET_PLAYER_LIST_ITEM);
- WriteString(a_OldListName);
- WriteBool (false);
- WriteShort (0);
- Flush();
- }
-
- SendPlayerListAddPlayer(a_Player);
+ // Not implemented in this protocol version
+ UNUSED(a_Player);
+ UNUSED(a_CustomName);
}
diff --git a/src/Protocol/Protocol125.h b/src/Protocol/Protocol125.h
index 4241c1fd4..3ea116c3b 100644
--- a/src/Protocol/Protocol125.h
+++ b/src/Protocol/Protocol125.h
@@ -69,7 +69,7 @@ public:
virtual void SendPlayerListRemovePlayer (const cPlayer & a_Player) override;
virtual void SendPlayerListUpdateGameMode (const cPlayer & a_Player) override;
virtual void SendPlayerListUpdatePing (const cPlayer & a_Player) override;
- virtual void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName) override;
+ virtual void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName) override;
virtual void SendPlayerMaxSpeed (void) override;
virtual void SendPlayerMoveLook (void) override;
virtual void SendPlayerPosition (void) override;
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index 73d2a74f9..ce4732471 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -838,23 +838,11 @@ void cProtocol172::SendPlayerListUpdatePing(const cPlayer & a_Player)
-void cProtocol172::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName)
+void cProtocol172::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName)
{
- ASSERT(m_State == 3); // In game mode?
- if (a_OldListName == a_Player.GetPlayerListName())
- {
- return;
- }
-
- // Remove the old name from the tablist:
- {
- cPacketizer Pkt(*this, 0x38);
- Pkt.WriteString(a_OldListName);
- Pkt.WriteBool(false);
- Pkt.WriteShort(0);
- }
-
- SendPlayerListAddPlayer(a_Player);
+ // Not implemented in this protocol version
+ UNUSED(a_Player);
+ UNUSED(a_CustomName);
}
diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h
index 7ec7d0fce..8f537f5d7 100644
--- a/src/Protocol/Protocol17x.h
+++ b/src/Protocol/Protocol17x.h
@@ -105,7 +105,7 @@ public:
virtual void SendPlayerListRemovePlayer (const cPlayer & a_Player) override;
virtual void SendPlayerListUpdateGameMode (const cPlayer & a_Player) override;
virtual void SendPlayerListUpdatePing (const cPlayer & a_Player) override;
- virtual void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName) override;
+ virtual void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName) override;
virtual void SendPlayerMaxSpeed (void) override;
virtual void SendPlayerMoveLook (void) override;
virtual void SendPlayerPosition (void) override;
diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp
index 896947d03..2ee50bb4a 100644
--- a/src/Protocol/Protocol18x.cpp
+++ b/src/Protocol/Protocol18x.cpp
@@ -802,7 +802,7 @@ void cProtocol180::SendPlayerListAddPlayer(const cPlayer & a_Player)
Pkt.WriteVarInt(0);
Pkt.WriteVarInt(1);
Pkt.WriteUUID(a_Player.GetUUID());
- Pkt.WriteString(a_Player.GetName());
+ Pkt.WriteString(a_Player.GetPlayerListName());
const Json::Value & Properties = a_Player.GetClientHandle()->GetProperties();
Pkt.WriteVarInt(Properties.size());
@@ -824,17 +824,7 @@ void cProtocol180::SendPlayerListAddPlayer(const cPlayer & a_Player)
Pkt.WriteVarInt((UInt32)a_Player.GetGameMode());
Pkt.WriteVarInt((UInt32)a_Player.GetClientHandle()->GetPing());
-
- AString CustomName = a_Player.GetPlayerListName();
- if (CustomName != a_Player.GetName())
- {
- Pkt.WriteBool(true);
- Pkt.WriteString(Printf("{\"text\":\"%s\"}", CustomName.c_str()));
- }
- else
- {
- Pkt.WriteBool(false);
- }
+ Pkt.WriteBool(false);
}
@@ -885,7 +875,7 @@ void cProtocol180::SendPlayerListUpdatePing(const cPlayer & a_Player)
-void cProtocol180::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName)
+void cProtocol180::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName)
{
ASSERT(m_State == 3); // In game mode?
@@ -894,15 +884,14 @@ void cProtocol180::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, con
Pkt.WriteVarInt(1);
Pkt.WriteUUID(a_Player.GetUUID());
- AString CustomName = a_Player.GetPlayerListName();
- if (CustomName == a_Player.GetName())
+ if (a_CustomName.empty())
{
Pkt.WriteBool(false);
}
else
{
Pkt.WriteBool(true);
- Pkt.WriteString(Printf("{\"text\":\"%s\"}", CustomName.c_str()));
+ Pkt.WriteString(Printf("{\"text\":\"%s\"}", a_CustomName.c_str()));
}
}
diff --git a/src/Protocol/Protocol18x.h b/src/Protocol/Protocol18x.h
index df188b70f..554edecc8 100644
--- a/src/Protocol/Protocol18x.h
+++ b/src/Protocol/Protocol18x.h
@@ -101,7 +101,7 @@ public:
virtual void SendPlayerListRemovePlayer (const cPlayer & a_Player) override;
virtual void SendPlayerListUpdateGameMode (const cPlayer & a_Player) override;
virtual void SendPlayerListUpdatePing (const cPlayer & a_Player) override;
- virtual void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName) override;
+ virtual void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName) override;
virtual void SendPlayerMaxSpeed (void) override;
virtual void SendPlayerMoveLook (void) override;
virtual void SendPlayerPosition (void) override;
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp
index a5b745c2f..fe53aede1 100644
--- a/src/Protocol/ProtocolRecognizer.cpp
+++ b/src/Protocol/ProtocolRecognizer.cpp
@@ -529,10 +529,10 @@ void cProtocolRecognizer::SendPlayerListUpdatePing(const cPlayer & a_Player)
-void cProtocolRecognizer::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName)
+void cProtocolRecognizer::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName)
{
ASSERT(m_Protocol != NULL);
- m_Protocol->SendPlayerListUpdateDisplayName(a_Player, a_OldListName);
+ m_Protocol->SendPlayerListUpdateDisplayName(a_Player, a_CustomName);
}
diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h
index 55348a758..e4419f6ae 100644
--- a/src/Protocol/ProtocolRecognizer.h
+++ b/src/Protocol/ProtocolRecognizer.h
@@ -105,7 +105,7 @@ public:
virtual void SendPlayerListRemovePlayer (const cPlayer & a_Player) override;
virtual void SendPlayerListUpdateGameMode (const cPlayer & a_Player) override;
virtual void SendPlayerListUpdatePing (const cPlayer & a_Player) override;
- virtual void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName) override;
+ virtual void SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_CustomName) override;
virtual void SendPlayerMaxSpeed (void) override;
virtual void SendPlayerMoveLook (void) override;
virtual void SendPlayerPosition (void) override;