13
0
geforkt von Mirrors/Velocity

Merge pull request #288 from Gabik21/fix-1.7-weirdness

Fix tablist behaving wrong with colors (1.7) (Fixes #282)
Dieser Commit ist enthalten in:
Andrew Steinborn 2020-04-07 11:51:21 -04:00 committet von GitHub
Commit 4374f1e4d6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -60,29 +60,25 @@ public class VelocityTabListLegacy extends VelocityTabList {
Item item = packet.getItems().get(0); // Only one item per packet in 1.7
Component displayName = LegacyComponentSerializer.legacy().deserialize(item.getName());
String strippedName = PlainComponentSerializer.INSTANCE.serialize(displayName);
switch (packet.getAction()) {
case PlayerListItem.ADD_PLAYER:
if (nameMapping.containsKey(strippedName)) { // ADD_PLAYER also used for updating ping
VelocityTabListEntry entry = entries.get(nameMapping.get(strippedName));
if (nameMapping.containsKey(item.getName())) { // ADD_PLAYER also used for updating ping
VelocityTabListEntry entry = entries.get(nameMapping.get(item.getName()));
if (entry != null) {
entry.setLatency(item.getLatency());
}
} else {
UUID uuid = UUID.randomUUID(); // Use a fake uuid to preserve function of custom entries
nameMapping.put(strippedName, uuid);
nameMapping.put(item.getName(), uuid);
entries.put(uuid, (VelocityTabListEntry) TabListEntry.builder()
.tabList(this)
.profile(new GameProfile(uuid, strippedName, ImmutableList.of()))
.displayName(displayName)
.profile(new GameProfile(uuid, item.getName(), ImmutableList.of()))
.latency(item.getLatency())
.build());
}
break;
case PlayerListItem.REMOVE_PLAYER:
UUID removedUuid = nameMapping.remove(strippedName);
UUID removedUuid = nameMapping.remove(item.getName());
if (removedUuid != null) {
entries.remove(removedUuid);
}