Archiviert
1
0

Fix npcs, revert failed fix

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,8 +97,10 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
}
}
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<PacketWrapper> {
// Main list handling
int i = 0;
List<PlayerListItem.Item> add = new ArrayList<>();
List<PlayerListItem.Item> 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<PacketWrapper> {
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<PacketWrapper> {
}
}
sendTabPacket(update, PlayerListItem.Action.UPDATE_DISPLAY_NAME);
sendTabPacket(add, PlayerListItem.Action.ADD_PLAYER);
// Excess removal
List<PlayerListItem.Item> 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() {