diff options
Diffstat (limited to 'spark-sponge8/src/main/java/me/lucko/spark')
-rw-r--r-- | spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8WorldInfoProvider.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8WorldInfoProvider.java b/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8WorldInfoProvider.java index bff4d6e..69b4515 100644 --- a/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8WorldInfoProvider.java +++ b/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8WorldInfoProvider.java @@ -20,6 +20,7 @@ package me.lucko.spark.sponge; +import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import me.lucko.spark.common.platform.world.AbstractChunkInfo; @@ -45,8 +46,24 @@ public class Sponge8WorldInfoProvider implements WorldInfoProvider { } @Override - public Result<Sponge7ChunkInfo> poll() { - Result<Sponge7ChunkInfo> data = new Result<>(); + public CountsResult pollCounts() { + int players = this.server.onlinePlayers().size(); + int entities = 0; + int tileEntities = 0; + int chunks = 0; + + for (ServerWorld world : this.server.worldManager().worlds()) { + entities += world.entities().size(); + tileEntities += world.blockEntities().size(); + chunks += Iterables.size(world.loadedChunks()); + } + + return new CountsResult(players, entities, tileEntities, chunks); + } + + @Override + public ChunksResult<Sponge7ChunkInfo> pollChunks() { + ChunksResult<Sponge7ChunkInfo> data = new ChunksResult<>(); for (ServerWorld world : this.server.worldManager().worlds()) { List<WorldChunk> chunks = Lists.newArrayList(world.loadedChunks()); |