Compare commits

..

2 Commits

Author SHA1 Message Date
ecc9932f5e New methods in ChunkCoord 2024-01-20 19:50:49 +01:00
e9b401f43d Fiw WorldUtil 2024-01-20 18:50:33 +01:00
2 changed files with 15 additions and 1 deletions

View File

@ -3,6 +3,8 @@ package fr.pandacube.lib.paper.world;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.World; import org.bukkit.World;
import java.util.concurrent.CompletableFuture;
public record ChunkCoord(int x, int z) { public record ChunkCoord(int x, int z) {
public ChunkCoord(Chunk c) { public ChunkCoord(Chunk c) {
@ -21,4 +23,16 @@ public record ChunkCoord(int x, int z) {
public Chunk getChunk(World w) { public Chunk getChunk(World w) {
return w.getChunkAt(x, z); return w.getChunkAt(x, z);
} }
public Chunk getChunk(World w, boolean generate) {
return w.getChunkAt(x, z, generate);
}
public CompletableFuture<Chunk> getChunkAsync(World w) {
return w.getChunkAtAsync(x, z);
}
public CompletableFuture<Chunk> getChunkAsync(World w, boolean generate) {
return w.getChunkAtAsync(x, z, generate);
}
} }

View File

@ -41,7 +41,7 @@ public class WorldUtil {
throw new IllegalStateException("Unable to determine the type of the world " + world + "."); throw new IllegalStateException("Unable to determine the type of the world " + world + ".");
} }
public List<RegionCoord> getExistingRegions(String world) { public static List<RegionCoord> getExistingRegions(String world) {
Environment env = determineEnvironment(world); Environment env = determineEnvironment(world);
File worldFolder = worldDir(world); File worldFolder = worldDir(world);