Tablist #411
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren