use of ivorius.reccomplex.files.loading.FileSuffixFilter in project RecurrentComplex by Ivorforce.
the class CommandRetrogen method existingRegions.
public static Stream<Pair<Integer, Integer>> existingRegions(File worldDir) {
File regionsDirectory = RCFiles.getValidatedFolder(new File(worldDir, "region"), false);
if (regionsDirectory == null)
return Stream.empty();
String[] mcas = regionsDirectory.list(new FileSuffixFilter("mca"));
if (mcas == null)
throw new IllegalStateException();
return Arrays.stream(mcas).map(s -> s.split("\\.")).filter(// Is region file
p -> p.length == 4 && p[0].equals("r")).map(p -> Pair.of(Integer.parseInt(p[1]), Integer.parseInt(p[2]))).filter(// Has coords
rfc -> rfc.getLeft() != null && rfc.getRight() != null);
}
Aggregations