Fix viewers Set size

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-12-09 15:20:07 +01:00
parent affd4f10e6
commit 61995e1b0c

View File

@ -222,7 +222,7 @@ public final class ViewEngine {
public int size() {
synchronized (mutex) {
int size = manualViewers.size();
if (entity != null) return size + viewableOption.bitSet.size();
if (entity != null) return size + viewableOption.bitSet.cardinality();
// Non-entity fallback
final List<List<Player>> auto = ViewEngine.this.viewableOption.references;
if (auto != null) {
@ -301,6 +301,7 @@ public final class ViewEngine {
Object[] array = new Object[size];
AtomicInteger index = new AtomicInteger();
forEach(player -> array[index.getAndIncrement()] = player);
assert index.get() == size;
return array;
}
}
@ -315,6 +316,7 @@ public final class ViewEngine {
AtomicInteger index = new AtomicInteger();
forEach(player -> array[index.getAndIncrement()] = (T) player);
assert index.get() == size;
return array;
}
}