From 593fe7389b1c7ca5bf2ec126373a6bde9714fff4 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 18 Jun 2022 17:31:57 +0200 Subject: [PATCH] Fix npcs, revert failed fix Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/tablist/Tablist.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/bungeecore/tablist/Tablist.java b/src/de/steamwar/bungeecore/tablist/Tablist.java index 896638b8..958952cd 100644 --- a/src/de/steamwar/bungeecore/tablist/Tablist.java +++ b/src/de/steamwar/bungeecore/tablist/Tablist.java @@ -97,8 +97,10 @@ public class Tablist extends MessageToMessageDecoder { } } for(PlayerListItem.Item item : directTabItems.values()) { - if(!nonNPCs.contains(item.getUuid()) && !npcs.contains(item.getUuid())) + if(!nonNPCs.contains(item.getUuid()) && !npcs.contains(item.getUuid())) { + npcs.add(item.getUuid()); addNpc.add(item.getUsername()); + } } } sendNpcPacket(addNpc, false); @@ -107,7 +109,6 @@ public class Tablist extends MessageToMessageDecoder { // Main list handling int i = 0; List add = new ArrayList<>(); - List remove = new ArrayList<>(); for (; i < tablist.size() && i < 80; i++) { PlayerListItem.Item tabItem; if(current.size() > i) { @@ -123,8 +124,6 @@ public class Tablist extends MessageToMessageDecoder { TablistPart.Item item = tablist.get(i); if(!Arrays.equals(tabItem.getProperties(), item.getProperties())) { - if(tabItem.getProperties() != null) - remove.add(tabItem); tabItem.setProperties(item.getProperties()); tabItem.setDisplayName(item.getDisplayName()); add.add(tabItem); @@ -134,13 +133,14 @@ public class Tablist extends MessageToMessageDecoder { } } sendTabPacket(update, PlayerListItem.Action.UPDATE_DISPLAY_NAME); + sendTabPacket(add, PlayerListItem.Action.ADD_PLAYER); // Excess removal + List remove = new ArrayList<>(); while(i < current.size()) { remove.add(current.remove(i)); } sendTabPacket(remove, PlayerListItem.Action.REMOVE_PLAYER); - sendTabPacket(add, PlayerListItem.Action.ADD_PLAYER); } public void onServerSwitch() {