Fixed Chunk load calculation on Sponge

This commit is contained in:
Rsl1122 2018-05-25 12:30:42 +03:00
parent 2b19983055
commit 15221d0edb

View File

@ -8,12 +8,10 @@ import com.djrapitops.plan.system.tasks.TPSCountTimer;
import com.djrapitops.plan.utilities.analysis.MathUtils;
import com.djrapitops.plugin.api.utility.log.Log;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.world.Chunk;
import org.spongepowered.api.world.World;
import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;
import java.util.Iterator;
public class SpongeTPSCountTimer extends TPSCountTimer<PlanSponge> {
@ -62,7 +60,7 @@ public class SpongeTPSCountTimer extends TPSCountTimer<PlanSponge> {
double tps = Sponge.getGame().getServer().getTicksPerSecond();
int playersOnline = ServerInfo.getServerProperties().getOnlinePlayers();
latestPlayersOnline = playersOnline;
int loadedChunks = -1;
int loadedChunks = getLoadedChunks();
int entityCount = getEntityCount();
return TPSBuilder.get()
@ -82,14 +80,9 @@ public class SpongeTPSCountTimer extends TPSCountTimer<PlanSponge> {
* @return amount of loaded chunks
*/
private int getLoadedChunks() {
// DISABLED
int loaded = 0;
for (World world : Sponge.getGame().getServer().getWorlds()) {
Iterator<Chunk> iterator = world.getLoadedChunks().iterator();
while (iterator.hasNext()) {
loaded++;
}
loaded += world.getLoadedChunks().spliterator().estimateSize();
}
return loaded;
}