mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-10-27 13:59:56 +01:00
Fixed Chunk load calculation on Sponge
This commit is contained in:
parent
2b19983055
commit
15221d0edb
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user