Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
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:
Commit
4374f1e4d6
@ -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);
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren