Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
eb469896f9
Commit
64567c1556
@ -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 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[] names = IntStream.range(0, 80).mapToObj(i -> " »SW« " + i).toArray(String[]::new);
|
||||||
private static final String TAB_TEAM = "»SW-Tab";
|
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 Map<UUID, PlayerListItem.Item> directTabItems;
|
||||||
private final Set<UUID> npcs = new HashSet<>();
|
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);
|
sendTabPacket(current, PlayerListItem.Action.REMOVE_PLAYER);
|
||||||
current.clear();
|
current.clear();
|
||||||
sendNpcPacket(npcs.stream().map(npc -> directTabItems.get(npc).getUsername()).collect(Collectors.toList()), true);
|
sendNpcPacket(npcs.stream().map(npc -> directTabItems.get(npc).getUsername()).collect(Collectors.toList()), true);
|
||||||
npcs.clear();
|
npcs.clear();
|
||||||
|
|
||||||
|
if(connection != null)
|
||||||
|
connection.getCh().getHandle().pipeline().remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -78,7 +78,7 @@ public class TablistManager extends BasicListener {
|
|||||||
|
|
||||||
public void disable() {
|
public void disable() {
|
||||||
synchronized (tablists) {
|
synchronized (tablists) {
|
||||||
tablists.forEach((player, tablist) -> tablist.remove());
|
tablists.forEach((player, tablist) -> tablist.disable());
|
||||||
tablists.clear();
|
tablists.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren