SteamWar/BungeeCore
Archiviert
13
2

Fix npcs #2
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2022-06-18 18:55:34 +02:00
Ursprung 593fe7389b
Commit c2338fe3d0

Datei anzeigen

@ -148,8 +148,8 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
synchronized (directTabItems) { synchronized (directTabItems) {
directTabItems.clear(); directTabItems.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) { if(connection != null) {
connection.getCh().getHandle().pipeline().addBefore(PipelineUtils.BOSS_HANDLER, "steamwar-tablist", this); connection.getCh().getHandle().pipeline().addBefore(PipelineUtils.BOSS_HANDLER, "steamwar-tablist", this);
@ -162,8 +162,8 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
current.clear(); current.clear();
synchronized (directTabItems) { synchronized (directTabItems) {
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) if(connection != null)
connection.getCh().getHandle().pipeline().remove(this); connection.getCh().getHandle().pipeline().remove(this);
@ -209,12 +209,15 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
} }
break; break;
case REMOVE_PLAYER: case REMOVE_PLAYER:
List<String> names = new ArrayList<>();
for(PlayerListItem.Item item : list.getItems()) { for(PlayerListItem.Item item : list.getItems()) {
synchronized (directTabItems) { synchronized (directTabItems) {
directTabItems.remove(item.getUuid()); PlayerListItem.Item directItem = directTabItems.remove(item.getUuid());
if(npcs.remove(item.getUuid()))
names.add(directItem.getUsername());
} }
npcs.remove(item.getUuid());
} }
sendNpcPacket(names, true);
break; break;
} }
} }