mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-18 14:50:57 +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"));
|
configWatcher = new FileWatcher(getDataFile("settings.json"));
|
||||||
services.values().forEach(IrisService::onEnable);
|
services.values().forEach(IrisService::onEnable);
|
||||||
services.values().forEach(this::registerListener);
|
services.values().forEach(this::registerListener);
|
||||||
|
if(IrisSettings.get().getGeneral().useIntegratedChunkHandler) {
|
||||||
chunkHandler = new ChunkHandler(this);
|
chunkHandler = new ChunkHandler(this);
|
||||||
|
Iris.info("Started Intergrated ChunkHandler");
|
||||||
|
}
|
||||||
J.s(() -> {
|
J.s(() -> {
|
||||||
J.a(() -> PaperLib.suggestPaper(this));
|
J.a(() -> PaperLib.suggestPaper(this));
|
||||||
J.a(() -> IO.delete(getTemp()));
|
J.a(() -> IO.delete(getTemp()));
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.util.Set;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
public class ChunkHandler implements Listener {
|
public class ChunkHandler implements Listener {
|
||||||
|
// Idk how it works but it works lol
|
||||||
private final JavaPlugin plugin;
|
private final JavaPlugin plugin;
|
||||||
private static BukkitTask task;
|
private static BukkitTask task;
|
||||||
private final Map<World, ChunkUnloader> worlds = new ConcurrentHashMap<>();
|
private final Map<World, ChunkUnloader> worlds = new ConcurrentHashMap<>();
|
||||||
@@ -153,10 +154,9 @@ public class ChunkHandler implements Listener {
|
|||||||
|
|
||||||
private void unloadChunk(Chunk chunk) {
|
private void unloadChunk(Chunk chunk) {
|
||||||
try {
|
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));
|
Bukkit.getScheduler().runTask(plugin, () -> chunk.unload(true));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Log the error message
|
|
||||||
System.out.println("Error unloading chunk: " + e.getMessage());
|
System.out.println("Error unloading chunk: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ public class IrisSettings {
|
|||||||
@Data
|
@Data
|
||||||
public static class IrisSettingsGeneral {
|
public static class IrisSettingsGeneral {
|
||||||
public boolean bootUnstable = false;
|
public boolean bootUnstable = false;
|
||||||
|
public boolean useIntegratedChunkHandler = false;
|
||||||
public boolean commandSounds = true;
|
public boolean commandSounds = true;
|
||||||
public boolean debug = false;
|
public boolean debug = false;
|
||||||
public boolean disableNMS = false;
|
public boolean disableNMS = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user