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:
Ursprung
933c81b9bf
Commit
a282afb5db
@ -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
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren