Archiviert
1
0
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2023-12-06 11:57:35 +01:00
Ursprung 3ea910501a
Commit 74cf9d4657

Datei anzeigen

@ -89,8 +89,8 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
if(tabItem == null) {
tablist.add(0, item);
} else if(!tabItem.getDisplayName().equals(item.getDisplayName())) {
tabItem.setDisplayName(TextComponent.fromLegacy(item.getDisplayName()));
} else if(!tabItem.getDisplayName().equals(wrapName(item.getDisplayName()))) {
tabItem.setDisplayName(wrapName(item.getDisplayName()));
tabItem.setListed(true);
update.add(tabItem);
}
@ -126,13 +126,13 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
TablistPart.Item item = tablist.get(i);
if(!Arrays.equals(tabItem.getProperties(), item.getProperties())) {
tabItem.setProperties(item.getProperties());
tabItem.setDisplayName(TextComponent.fromLegacy(item.getDisplayName()));
tabItem.setDisplayName(wrapName(item.getDisplayName()));
add.add(tabItem);
if(current.size() > i) {
remove.add(tabItem);
}
} else if(!item.getDisplayName().equals(tabItem.getDisplayName())) {
tabItem.setDisplayName(TextComponent.fromLegacy(item.getDisplayName()));
tabItem.setDisplayName(wrapName(item.getDisplayName()));
update.add(tabItem);
}
}
@ -212,7 +212,7 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
case ADD_PLAYER:
for (PlayerListItem.Item item : list.getItems()) {
item.setPing(1);
item.setDisplayName(TextComponent.fromLegacy(""));
item.setDisplayName(wrapName(""));
item.setListed(false);
item.setPublicKey(null);
if(!player.getUniqueId().equals(item.getUuid()) && item.getGamemode() == 3)
@ -262,7 +262,7 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
case ADD_PLAYER:
for (PlayerListItem.Item item : list.getItems()) {
item.setPing(1);
item.setDisplayName(TextComponent.fromLegacy(""));
item.setDisplayName(wrapName(""));
item.setListed(false);
item.setPublicKey(null);
if(!player.getUniqueId().equals(item.getUuid()) && item.getGamemode() == 3)
@ -304,6 +304,10 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
return player.getPendingConnection().getVersion() < ProtocolConstants.MINECRAFT_1_19_3;
}
private BaseComponent wrapName(String name) {
return new TextComponent(TextComponent.fromLegacyText(name));
}
private void sendTabPacket(List<PlayerListItem.Item> items, PlayerListItem.Action action) { //Breaks in 1.19.3 if action != UPDATE_DISPLAY_NAME, ADD_PLAYER or REMOVE_PLAYER
if(!items.isEmpty()) {
if(oldTab()) {