mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-23 17:19:16 +00:00
Additions to ChunkHandler.java
This commit is contained in:
@@ -121,6 +121,7 @@ public class ChunkHandler implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
|
try {
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
Set<Chunk> chunkSet = new HashSet<>(chunks.keySet());
|
Set<Chunk> chunkSet = new HashSet<>(chunks.keySet());
|
||||||
for (Chunk chunk : chunkSet) {
|
for (Chunk chunk : chunkSet) {
|
||||||
@@ -134,7 +135,12 @@ public class ChunkHandler implements Listener {
|
|||||||
unloadChunk(chunk);
|
unloadChunk(chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Log the error message
|
||||||
|
System.out.println("Error in update method: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean isChunkNearby(Chunk chunk) {
|
private boolean isChunkNearby(Chunk chunk) {
|
||||||
Set<Player> players = playersInChunk.get(chunk);
|
Set<Player> players = playersInChunk.get(chunk);
|
||||||
@@ -146,8 +152,13 @@ public class ChunkHandler implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void unloadChunk(Chunk chunk) {
|
private void unloadChunk(Chunk chunk) {
|
||||||
//System.out.printf("%s > Unloading Chunk [x=%s, z=%s]%n", world.getName(), chunk.getX(), chunk.getZ());
|
try {
|
||||||
|
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) {
|
||||||
|
// Log the error message
|
||||||
|
System.out.println("Error unloading chunk: " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user