SteamWar/BungeeCore
Archiviert
13
2

Tablist #411

Zusammengeführt
Lixfel hat 13 Commits von tablist nach master 2022-06-18 15:31:48 +02:00 zusammengeführt
2 geänderte Dateien mit 6 neuen und 3 gelöschten Zeilen
Nur Änderungen aus Commit 64567c1556 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -47,7 +47,7 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
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« " + i).toArray(String[]::new);
private static final String TAB_TEAM = "»SW-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", "never", 21, (byte)0x00, names);
private static final Team teamPacket = new Team(TAB_TEAM, (byte) 0, ComponentSerializer.toString(TextComponent.fromLegacyText("")), ComponentSerializer.toString(TextComponent.fromLegacyText("")), ComponentSerializer.toString(TextComponent.fromLegacyText("")), "always", "always", 21, (byte)0x00, names);
private final Map<UUID, PlayerListItem.Item> directTabItems;
private final Set<UUID> npcs = new HashSet<>();
@ -150,11 +150,14 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
}
}
public void remove() {
public void disable() {
sendTabPacket(current, PlayerListItem.Action.REMOVE_PLAYER);
current.clear();
sendNpcPacket(npcs.stream().map(npc -> directTabItems.get(npc).getUsername()).collect(Collectors.toList()), true);
npcs.clear();
if(connection != null)
connection.getCh().getHandle().pipeline().remove(this);
}
@Override

Datei anzeigen

@ -78,7 +78,7 @@ public class TablistManager extends BasicListener {
public void disable() {
synchronized (tablists) {
tablists.forEach((player, tablist) -> tablist.remove());
tablists.forEach((player, tablist) -> tablist.disable());
tablists.clear();
}
}