diff --git a/src/de/steamwar/bungeecore/tablist/Tablist.java b/src/de/steamwar/bungeecore/tablist/Tablist.java index 2715dd5f..c529edfb 100644 --- a/src/de/steamwar/bungeecore/tablist/Tablist.java +++ b/src/de/steamwar/bungeecore/tablist/Tablist.java @@ -31,9 +31,9 @@ import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.chat.ComponentSerializer; import net.md_5.bungee.netty.PipelineUtils; import net.md_5.bungee.protocol.DefinedPacket; +import net.md_5.bungee.protocol.Either; import net.md_5.bungee.protocol.PacketWrapper; import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.packet.*; @@ -48,7 +48,7 @@ public class Tablist extends MessageToMessageDecoder { private static final UUID[] uuids = IntStream.range(0, 80).mapToObj(i -> UUID.randomUUID()).toArray(UUID[]::new); private static final String[] names = IntStream.range(0, 80).mapToObj(i -> " »SW« " + String.format("%02d", i)).toArray(String[]::new); private static final String TAB_TEAM = "zzzzzsw-tab"; - private static final Team teamPacket = new Team(TAB_TEAM, (byte) 0, ComponentSerializer.toString(TextComponent.fromLegacyText("")), ComponentSerializer.toString(TextComponent.fromLegacyText("")), ComponentSerializer.toString(TextComponent.fromLegacyText("")), "never", "always", 21, (byte)0x00, names); + private static final Team teamPacket = new Team(TAB_TEAM, (byte) 0, Either.right(TextComponent.fromLegacy("")), Either.right(TextComponent.fromLegacy("")), Either.right(TextComponent.fromLegacy("")), "never", "always", 21, (byte)0x00, names); private final Map directTabItems; private final Set npcs = new HashSet<>(); @@ -90,7 +90,7 @@ public class Tablist extends MessageToMessageDecoder { if(tabItem == null) { tablist.add(0, item); } else if(!tabItem.getDisplayName().equals(item.getDisplayName())) { - tabItem.setDisplayName(item.getDisplayName()); + tabItem.setDisplayName(TextComponent.fromLegacy(item.getDisplayName())); tabItem.setListed(true); update.add(tabItem); } @@ -126,13 +126,13 @@ public class Tablist extends MessageToMessageDecoder { TablistPart.Item item = tablist.get(i); if(!Arrays.equals(tabItem.getProperties(), item.getProperties())) { tabItem.setProperties(item.getProperties()); - tabItem.setDisplayName(item.getDisplayName()); + tabItem.setDisplayName(TextComponent.fromLegacy(item.getDisplayName())); add.add(tabItem); if(current.size() > i) { remove.add(tabItem); } } else if(!item.getDisplayName().equals(tabItem.getDisplayName())) { - tabItem.setDisplayName(item.getDisplayName()); + tabItem.setDisplayName(TextComponent.fromLegacy(item.getDisplayName())); update.add(tabItem); } } @@ -212,7 +212,7 @@ public class Tablist extends MessageToMessageDecoder { case ADD_PLAYER: for (PlayerListItem.Item item : list.getItems()) { item.setPing(1); - item.setDisplayName(ComponentSerializer.toString(TextComponent.fromLegacyText(""))); + item.setDisplayName(TextComponent.fromLegacy("")); item.setListed(false); item.setPublicKey(null); if(!player.getUniqueId().equals(item.getUuid()) && item.getGamemode() == 3) @@ -262,7 +262,7 @@ public class Tablist extends MessageToMessageDecoder { case ADD_PLAYER: for (PlayerListItem.Item item : list.getItems()) { item.setPing(1); - item.setDisplayName(ComponentSerializer.toString(TextComponent.fromLegacyText(""))); + item.setDisplayName(TextComponent.fromLegacy("")); item.setListed(false); item.setPublicKey(null); if(!player.getUniqueId().equals(item.getUuid()) && item.getGamemode() == 3)