3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-23 23:00:35 +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()}.
*/
public void clearAll() {
List<PlayerListItem.Item> items = new ArrayList<>();
for (TabListEntry value : entries.values()) {
Collection<VelocityTabListEntry> listEntries = entries.values();
if (listEntries.isEmpty()) {
return;
}
List<PlayerListItem.Item> items = new ArrayList<>(listEntries.size());
for (TabListEntry value : listEntries) {
items.add(PlayerListItem.Item.from(value));
}
entries.clear();
if (!items.isEmpty()) {
connection.delayedWrite(new PlayerListItem(PlayerListItem.REMOVE_PLAYER, items));
}
connection.delayedWrite(new PlayerListItem(PlayerListItem.REMOVE_PLAYER, items));
}
@Override