diff --git a/src/de/steamwar/bungeecore/tablist/Tablist.java b/src/de/steamwar/bungeecore/tablist/Tablist.java index 896638b..958952c 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() {