3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-16 21:10:30 +01:00

Merge pull request #342 from xxDark/tab

Return earlier, predict list's size for tab clearing
Dieser Commit ist enthalten in:
Andrew Steinborn 2020-07-31 14:06:20 -04:00 committet von GitHub
Commit fc51f1c203
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

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