clear force load chunks before load
Some checks failed
Java CI-CD with Maven / build (push) Failing after 1h5m27s

This commit is contained in:
zhangyuheng 2024-03-26 00:40:02 +08:00
parent 7d673906cf
commit f97823af79
2 changed files with 13 additions and 1 deletions

View File

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

View File

@ -5,6 +5,7 @@ import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
public class ConfigManager {
public ConfigManager(EssentialsD plugin) {
@ -43,6 +44,17 @@ public class ConfigManager {
}
public void ApplyForceLoadChunks() {
// remove all force loaded chunks
AtomicInteger count = new AtomicInteger();
for (World world : _plugin.getServer().getWorlds()) {
world.getForceLoadedChunks().forEach((chunk) -> {
count.getAndIncrement();
EssentialsD.globalScheduler.run(EssentialsD.instance, (instance) -> {
world.setChunkForceLoaded(chunk.getX(), chunk.getZ(), false);
});
});
}
XLogger.info("清除 " + count.get() + " 个强加载区块");
// world:0:0
for (String s : _force_load_chunks) {
String[] split = s.split(":");