mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2025-08-10 06:23:14 +00:00
[UNSTABLE] Major restructuring
This commit is contained in:
parent
cd1c0bcee8
commit
b95acd5d62
12 changed files with 717 additions and 707 deletions
|
@ -62,17 +62,34 @@ public class ChunkManager {
|
|||
}
|
||||
|
||||
public static ArrayList<ChunkLoc> getChunkChunks(World world) {
|
||||
File[] regionFiles = new File(world.getName() + File.separator + "region").listFiles();
|
||||
String directory = new File(".").getAbsolutePath() + File.separator + world.getName() + File.separator + "region";
|
||||
|
||||
File folder = new File(directory);
|
||||
File[] regionFiles = folder.listFiles();
|
||||
|
||||
ArrayList<ChunkLoc> chunks = new ArrayList<>();
|
||||
|
||||
for (File file : regionFiles) {
|
||||
String name = file.getName();
|
||||
if (name.endsWith("mca")) {
|
||||
String[] split = name.split("\\.");
|
||||
try {
|
||||
chunks.add(new ChunkLoc(Integer.parseInt(split[1]), Integer.parseInt(split[2])));
|
||||
} catch (Exception e) { }
|
||||
int x = Integer.parseInt(split[1]);
|
||||
int z = Integer.parseInt(split[2]);
|
||||
ChunkLoc loc = new ChunkLoc(x, z);
|
||||
chunks.add(loc);
|
||||
}
|
||||
catch (Exception e) { }
|
||||
}
|
||||
}
|
||||
|
||||
for (Chunk chunk : world.getLoadedChunks()) {
|
||||
ChunkLoc loc = new ChunkLoc(chunk.getX() >> 5, chunk.getZ() >> 5);
|
||||
if (!chunks.contains(loc)) {
|
||||
chunks.add(loc);
|
||||
}
|
||||
}
|
||||
|
||||
return chunks;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue