diff options
author | Franz Reiter <franzi.moos@googlemail.com> | 2014-09-23 15:54:07 +0200 |
---|---|---|
committer | Franz Reiter <franzi.moos@googlemail.com> | 2014-09-23 15:54:07 +0200 |
commit | 33f8091d5f550a91b1fbe24f07a397aa5a336093 (patch) | |
tree | 4fe1be83dd4212e010fed749cd444c4deecc64e6 /src/Protocol/Protocol18x.cpp | |
parent | QtBiomeVisualiser: Fixed confusion about Globals.h. (diff) | |
parent | Fixed SQLiteCpp downgrade (diff) | |
download | cuberite-33f8091d5f550a91b1fbe24f07a397aa5a336093.tar cuberite-33f8091d5f550a91b1fbe24f07a397aa5a336093.tar.gz cuberite-33f8091d5f550a91b1fbe24f07a397aa5a336093.tar.bz2 cuberite-33f8091d5f550a91b1fbe24f07a397aa5a336093.tar.lz cuberite-33f8091d5f550a91b1fbe24f07a397aa5a336093.tar.xz cuberite-33f8091d5f550a91b1fbe24f07a397aa5a336093.tar.zst cuberite-33f8091d5f550a91b1fbe24f07a397aa5a336093.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Protocol18x.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp index a7ab3abb1..e2ea6701a 100644 --- a/src/Protocol/Protocol18x.cpp +++ b/src/Protocol/Protocol18x.cpp @@ -824,7 +824,17 @@ void cProtocol180::SendPlayerListAddPlayer(const cPlayer & a_Player) Pkt.WriteVarInt((UInt32)a_Player.GetGameMode()); Pkt.WriteVarInt((UInt32)a_Player.GetClientHandle()->GetPing()); - Pkt.WriteBool(false); + + 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); + } } @@ -877,7 +887,6 @@ void cProtocol180::SendPlayerListUpdatePing(const cPlayer & a_Player) void cProtocol180::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, const AString & a_OldListName) { - UNUSED(a_OldListName); ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, 0x38); // Playerlist Item packet @@ -885,15 +894,15 @@ void cProtocol180::SendPlayerListUpdateDisplayName(const cPlayer & a_Player, con Pkt.WriteVarInt(1); Pkt.WriteUUID(a_Player.GetUUID()); - // TODO: Replace this with GetPlayerListName() (It's already done in other pull request) - if (a_Player.GetName().empty()) + AString CustomName = a_Player.GetPlayerListName(); + if (CustomName == a_Player.GetName()) { Pkt.WriteBool(false); } else { Pkt.WriteBool(true); - Pkt.WriteString(Printf("{\"text\":\"%s\"}", a_Player.GetName().c_str())); + Pkt.WriteString(Printf("{\"text\":\"%s\"}", CustomName.c_str())); } } |