Collection<Chunk> chunks = world.getForceLoadedChunks(); have problem

This commit is contained in:
zhangyuheng 2024-03-26 01:42:52 +08:00
parent 9885c62232
commit 9f617e046e
2 changed files with 6 additions and 5 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId>
<artifactId>EssentialsD</artifactId>
<version>1.12.6</version>
<version>1.12.8</version>
<packaging>jar</packaging>
<name>EssentialsD</name>

View File

@ -47,17 +47,18 @@ public class ConfigManager {
public void ApplyForceLoadChunks() {
// remove all force loaded chunks
AtomicInteger count = new AtomicInteger();
EssentialsD.globalScheduler.run(EssentialsD.instance, (instance) -> {
int count = 0;
for (World world : EssentialsD.instance.getServer().getWorlds()) {
Collection<Chunk> chunks = world.getForceLoadedChunks();
XLogger.debug("清除所有强加载区块: " + world.getName());
Collection<Chunk> chunks = world.getForceLoadedChunks(); // todo 这里有问题
for (Chunk chunk : chunks) {
count.getAndIncrement();
count++;
world.setChunkForceLoaded(chunk.getX(), chunk.getZ(), false);
}
}
XLogger.info("清除所有强加载区块: " + count);
});
XLogger.info("清除 " + count.get() + " 个强加载区块");
// world:0:0
for (String s : _force_load_chunks) {
String[] split = s.split(":");