13
0
geforkt von Mirrors/Velocity

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,15 +89,17 @@ 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
public Collection<TabListEntry> getEntries() { public Collection<TabListEntry> getEntries() {