Implement tab list display name update

Packet 0x2D with action 0x03
This commit is contained in:
ORelio 2016-08-23 00:13:46 +02:00
parent 461385d057
commit b1d4f85b23
4 changed files with 31 additions and 7 deletions

View file

@ -447,8 +447,17 @@ namespace MinecraftClient.Protocol.Handlers
readNextVarInt(packetData);
break;
case 0x03: //Update display name
if (readNextBool(packetData))
readNextString(packetData);
bool hasDisplayName = readNextBool(packetData);
string newDisplayName = null;
if (hasDisplayName)
newDisplayName = readNextString(packetData);
PlayerInfo player = handler.GetPlayer(uuid);
if (player != null)
{
if (hasDisplayName)
player.DisplayName = newDisplayName;
else player.DisplayName = player.Name;
}
break;
case 0x04: //Player Leave
handler.OnPlayerLeave(uuid);