aboutsummaryrefslogtreecommitdiff
path: root/spark-bukkit
diff options
context:
space:
mode:
authorvaperion <vaperion@riseup.net>2022-12-31 15:58:43 +0100
committerlucko <git@lucko.me>2022-12-31 18:31:07 +0000
commitbcea61e5b221fd0c0ee6c2bc17c53473dc54c4fd (patch)
tree96599a8ed75003e698d2f43ae89e0f56554cbef8 /spark-bukkit
parentd6d2e31169af5966e244585582a4ccea317cecb3 (diff)
downloadspark-bcea61e5b221fd0c0ee6c2bc17c53473dc54c4fd.tar.gz
spark-bcea61e5b221fd0c0ee6c2bc17c53473dc54c4fd.tar.bz2
spark-bcea61e5b221fd0c0ee6c2bc17c53473dc54c4fd.zip
Exclude null chunks from the total chunk count
Diffstat (limited to 'spark-bukkit')
-rw-r--r--spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java
index 8a4c0e4..babb0bc 100644
--- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java
+++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java
@@ -70,12 +70,21 @@ public class BukkitWorldInfoProvider implements WorldInfoProvider {
chunks += world.getChunkCount();
} else {
entities += world.getEntities().size();
+
Chunk[] chunksArray = world.getLoadedChunks();
+ int nullChunks = 0;
+
for (Chunk chunk : chunksArray) {
+ if (chunk == null) {
+ ++nullChunks;
+ continue;
+ }
+
BlockState[] tileEntitiesArray = chunk.getTileEntities();
tileEntities += tileEntitiesArray != null ? tileEntitiesArray.length : 0;
}
- chunks += chunksArray.length;
+
+ chunks += chunksArray.length - nullChunks;
}
}