3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

Return earlier, predict list's size for tab clearing

Dieser Commit ist enthalten in:
xDark 2020-07-31 19:19:26 +03:00
Ursprung 933c81b9bf
Commit a282afb5db

Datei anzeigen

@ -89,14 +89,16 @@ public class VelocityTabList implements TabList {
* MinecraftConnection#flush()}. * MinecraftConnection#flush()}.
*/ */
public void clearAll() { public void clearAll() {
List<PlayerListItem.Item> items = new ArrayList<>(); Collection<VelocityTabListEntry> listEntries = entries.values();
for (TabListEntry value : entries.values()) { if (listEntries.isEmpty()) {
return;
}
List<PlayerListItem.Item> items = new ArrayList<>(listEntries.size());
for (TabListEntry value : listEntries) {
items.add(PlayerListItem.Item.from(value)); items.add(PlayerListItem.Item.from(value));
} }
entries.clear(); entries.clear();
if (!items.isEmpty()) { connection.delayedWrite(new PlayerListItem(PlayerListItem.REMOVE_PLAYER, items));
connection.delayedWrite(new PlayerListItem(PlayerListItem.REMOVE_PLAYER, items));
}
} }
@Override @Override