mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-28 12:07:42 +01:00
Fix viewers Set size
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
affd4f10e6
commit
61995e1b0c
@ -222,7 +222,7 @@ public final class ViewEngine {
|
|||||||
public int size() {
|
public int size() {
|
||||||
synchronized (mutex) {
|
synchronized (mutex) {
|
||||||
int size = manualViewers.size();
|
int size = manualViewers.size();
|
||||||
if (entity != null) return size + viewableOption.bitSet.size();
|
if (entity != null) return size + viewableOption.bitSet.cardinality();
|
||||||
// Non-entity fallback
|
// Non-entity fallback
|
||||||
final List<List<Player>> auto = ViewEngine.this.viewableOption.references;
|
final List<List<Player>> auto = ViewEngine.this.viewableOption.references;
|
||||||
if (auto != null) {
|
if (auto != null) {
|
||||||
@ -301,6 +301,7 @@ public final class ViewEngine {
|
|||||||
Object[] array = new Object[size];
|
Object[] array = new Object[size];
|
||||||
AtomicInteger index = new AtomicInteger();
|
AtomicInteger index = new AtomicInteger();
|
||||||
forEach(player -> array[index.getAndIncrement()] = player);
|
forEach(player -> array[index.getAndIncrement()] = player);
|
||||||
|
assert index.get() == size;
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,6 +316,7 @@ public final class ViewEngine {
|
|||||||
|
|
||||||
AtomicInteger index = new AtomicInteger();
|
AtomicInteger index = new AtomicInteger();
|
||||||
forEach(player -> array[index.getAndIncrement()] = (T) player);
|
forEach(player -> array[index.getAndIncrement()] = (T) player);
|
||||||
|
assert index.get() == size;
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user