mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-31 04:46:40 +00:00
Added setting option for ChunkHandler.java and no more random freezes.
This commit is contained in:
@@ -459,7 +459,10 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
configWatcher = new FileWatcher(getDataFile("settings.json"));
|
||||
services.values().forEach(IrisService::onEnable);
|
||||
services.values().forEach(this::registerListener);
|
||||
chunkHandler = new ChunkHandler(this);
|
||||
if(IrisSettings.get().getGeneral().useIntegratedChunkHandler) {
|
||||
chunkHandler = new ChunkHandler(this);
|
||||
Iris.info("Started Intergrated ChunkHandler");
|
||||
}
|
||||
J.s(() -> {
|
||||
J.a(() -> PaperLib.suggestPaper(this));
|
||||
J.a(() -> IO.delete(getTemp()));
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
public class ChunkHandler implements Listener {
|
||||
// Idk how it works but it works lol
|
||||
private final JavaPlugin plugin;
|
||||
private static BukkitTask task;
|
||||
private final Map<World, ChunkUnloader> worlds = new ConcurrentHashMap<>();
|
||||
@@ -153,10 +154,9 @@ public class ChunkHandler implements Listener {
|
||||
|
||||
private void unloadChunk(Chunk chunk) {
|
||||
try {
|
||||
System.out.printf("%s > Unloading Chunk [x=%s, z=%s]%n", world.getName(), chunk.getX(), chunk.getZ());
|
||||
// System.out.printf("%s > Unloading Chunk [x=%s, z=%s]%n", world.getName(), chunk.getX(), chunk.getZ());
|
||||
Bukkit.getScheduler().runTask(plugin, () -> chunk.unload(true));
|
||||
} catch (Exception e) {
|
||||
// Log the error message
|
||||
System.out.println("Error unloading chunk: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,6 +146,7 @@ public class IrisSettings {
|
||||
@Data
|
||||
public static class IrisSettingsGeneral {
|
||||
public boolean bootUnstable = false;
|
||||
public boolean useIntegratedChunkHandler = false;
|
||||
public boolean commandSounds = true;
|
||||
public boolean debug = false;
|
||||
public boolean disableNMS = false;
|
||||
|
||||
Reference in New Issue
Block a user