mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 06:11:24 +00:00
cleanup PopulationManager
This commit is contained in:
@@ -1,21 +0,0 @@
|
|||||||
package com.dfsek.terra.bukkit.population;
|
|
||||||
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.platform.world.World;
|
|
||||||
import com.dfsek.terra.bukkit.world.BukkitWorld;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class Gaea {
|
|
||||||
private static boolean debug;
|
|
||||||
|
|
||||||
public static File getGaeaFolder(World w) {
|
|
||||||
File f = new File(((BukkitWorld) w).getWorldFolder(), "gaea");
|
|
||||||
f.mkdirs();
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isDebug() {
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+8
-2
@@ -33,17 +33,23 @@ public class PopulationManager extends BlockPopulator {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public synchronized void saveBlocks(World w) throws IOException {
|
public synchronized void saveBlocks(World w) throws IOException {
|
||||||
File f = new File(Gaea.getGaeaFolder(w), "chunks.bin");
|
File f = new File(getDataFolder(w), "chunks.bin");
|
||||||
f.createNewFile();
|
f.createNewFile();
|
||||||
SerializationUtil.toFile((HashSet<ChunkCoordinate>) needsPop.clone(), f);
|
SerializationUtil.toFile((HashSet<ChunkCoordinate>) needsPop.clone(), f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public synchronized void loadBlocks(World w) throws IOException, ClassNotFoundException {
|
public synchronized void loadBlocks(World w) throws IOException, ClassNotFoundException {
|
||||||
File f = new File(Gaea.getGaeaFolder(w), "chunks.bin");
|
File f = new File(getDataFolder(w), "chunks.bin");
|
||||||
needsPop.addAll((HashSet<ChunkCoordinate>) SerializationUtil.fromFile(f));
|
needsPop.addAll((HashSet<ChunkCoordinate>) SerializationUtil.fromFile(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static File getDataFolder(World w) {
|
||||||
|
File f = new File(((BukkitWorld) w).getWorldFolder(), "gaea");
|
||||||
|
f.mkdirs();
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Synchronize to prevent chunks from being queued for population multiple times.
|
// Synchronize to prevent chunks from being queued for population multiple times.
|
||||||
public synchronized void checkNeighbors(int x, int z, World world) {
|
public synchronized void checkNeighbors(int x, int z, World world) {
|
||||||
|
|||||||
Reference in New Issue
Block a user