summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol125.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-02 19:12:35 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-02 19:12:35 +0200
commit1bb4d7941267ee55cdf7f35fa6a0055521115960 (patch)
tree38b2faa2d824bca6da9ec88c2c0c0d9bbe81f6df /src/Protocol/Protocol125.cpp
parentAdded name tag (diff)
downloadcuberite-1bb4d7941267ee55cdf7f35fa6a0055521115960.tar
cuberite-1bb4d7941267ee55cdf7f35fa6a0055521115960.tar.gz
cuberite-1bb4d7941267ee55cdf7f35fa6a0055521115960.tar.bz2
cuberite-1bb4d7941267ee55cdf7f35fa6a0055521115960.tar.lz
cuberite-1bb4d7941267ee55cdf7f35fa6a0055521115960.tar.xz
cuberite-1bb4d7941267ee55cdf7f35fa6a0055521115960.tar.zst
cuberite-1bb4d7941267ee55cdf7f35fa6a0055521115960.zip
Diffstat (limited to 'src/Protocol/Protocol125.cpp')
-rw-r--r--src/Protocol/Protocol125.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/Protocol/Protocol125.cpp b/src/Protocol/Protocol125.cpp
index a66c64309..0b5e3de91 100644
--- a/src/Protocol/Protocol125.cpp
+++ b/src/Protocol/Protocol125.cpp
@@ -719,21 +719,13 @@ void cProtocol125::SendPaintingSpawn(const cPainting & a_Painting)
-void cProtocol125::SendPlayerListItem(const cPlayer & a_Player, bool a_IsOnline)
+void cProtocol125::SendPlayerListItem(const AString & a_PlayerName, bool a_IsOnline, short a_Ping)
{
cCSLock Lock(m_CSPacket);
- AString PlayerName(a_Player.GetColor());
- PlayerName.append(a_Player.GetName());
- if (PlayerName.length() > 14)
- {
- PlayerName.erase(14);
- }
- PlayerName += cChatColor::White;
-
WriteByte ((unsigned char)PACKET_PLAYER_LIST_ITEM);
- WriteString(PlayerName);
+ WriteString(a_PlayerName);
WriteBool (a_IsOnline);
- WriteShort (a_IsOnline ? a_Player.GetClientHandle()->GetPing() : 0);
+ WriteShort (a_Ping);
Flush();
}
@@ -792,7 +784,14 @@ void cProtocol125::SendPlayerSpawn(const cPlayer & a_Player)
cCSLock Lock(m_CSPacket);
WriteByte (PACKET_PLAYER_SPAWN);
WriteInt (a_Player.GetUniqueID());
- WriteString(a_Player.GetName());
+ if (a_Player.HasCustomName())
+ {
+ WriteString(a_Player.GetCustomName());
+ }
+ else
+ {
+ WriteString(a_Player.GetName());
+ }
WriteInt ((int)(a_Player.GetPosX() * 32));
WriteInt ((int)(a_Player.GetPosY() * 32));
WriteInt ((int)(a_Player.GetPosZ() * 32));