diff options
Diffstat (limited to 'spark-bukkit/src/main/java/me/lucko/spark/bukkit')
-rw-r--r-- | spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java | 11 |
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; } } |