SteamWar/BungeeCore
Archiviert
13
2

Fix npcs, revert failed fix
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 17:31:57 +02:00
Ursprung cc01a4132d
Commit 593fe7389b

Datei anzeigen

@ -97,17 +97,18 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
} }
} }
for(PlayerListItem.Item item : directTabItems.values()) { 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()); addNpc.add(item.getUsername());
} }
} }
}
sendNpcPacket(addNpc, false); sendNpcPacket(addNpc, false);
sendNpcPacket(removeNpc, true); sendNpcPacket(removeNpc, true);
// Main list handling // Main list handling
int i = 0; int i = 0;
List<PlayerListItem.Item> add = new ArrayList<>(); List<PlayerListItem.Item> add = new ArrayList<>();
List<PlayerListItem.Item> remove = new ArrayList<>();
for (; i < tablist.size() && i < 80; i++) { for (; i < tablist.size() && i < 80; i++) {
PlayerListItem.Item tabItem; PlayerListItem.Item tabItem;
if(current.size() > i) { if(current.size() > i) {
@ -123,8 +124,6 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
TablistPart.Item item = tablist.get(i); TablistPart.Item item = tablist.get(i);
if(!Arrays.equals(tabItem.getProperties(), item.getProperties())) { if(!Arrays.equals(tabItem.getProperties(), item.getProperties())) {
if(tabItem.getProperties() != null)
remove.add(tabItem);
tabItem.setProperties(item.getProperties()); tabItem.setProperties(item.getProperties());
tabItem.setDisplayName(item.getDisplayName()); tabItem.setDisplayName(item.getDisplayName());
add.add(tabItem); add.add(tabItem);
@ -134,13 +133,14 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
} }
} }
sendTabPacket(update, PlayerListItem.Action.UPDATE_DISPLAY_NAME); sendTabPacket(update, PlayerListItem.Action.UPDATE_DISPLAY_NAME);
sendTabPacket(add, PlayerListItem.Action.ADD_PLAYER);
// Excess removal // Excess removal
List<PlayerListItem.Item> remove = new ArrayList<>();
while(i < current.size()) { while(i < current.size()) {
remove.add(current.remove(i)); remove.add(current.remove(i));
} }
sendTabPacket(remove, PlayerListItem.Action.REMOVE_PLAYER); sendTabPacket(remove, PlayerListItem.Action.REMOVE_PLAYER);
sendTabPacket(add, PlayerListItem.Action.ADD_PLAYER);
} }
public void onServerSwitch() { public void onServerSwitch() {