Store extended player info, list display names

- Add 1.10.1 and 1.10.2 in supported version list
 - Store both player name and player display names
 - List command will sort players by player name
 - List command will now display by display name
 - Ability to use /list raw to display by real name

Suggestion by Johngreen123
This commit is contained in:
ORelio 2016-08-22 19:09:43 +02:00
parent a4cc36ce05
commit 9a98a9d46f
10 changed files with 156 additions and 85 deletions

View file

@ -437,9 +437,10 @@ namespace MinecraftClient.Protocol.Handlers
}
readNextVarInt(packetData);
readNextVarInt(packetData);
string displayName = name;
if (readNextBool(packetData))
readNextString(packetData);
handler.OnPlayerJoin(uuid, name);
displayName = readNextString(packetData);
handler.OnPlayerJoin(new PlayerInfo(uuid, name, displayName));
break;
case 0x01: //Update gamemode
case 0x02: //Update latency
@ -465,7 +466,7 @@ namespace MinecraftClient.Protocol.Handlers
short ping = readNextShort(packetData);
Guid FakeUUID = new Guid(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(name)).Take(16).ToArray());
if (online)
handler.OnPlayerJoin(FakeUUID, name);
handler.OnPlayerJoin(new PlayerInfo(FakeUUID, name));
else handler.OnPlayerLeave(FakeUUID);
}
break;