mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-15 01:08:35 +00:00
Various command (use es6 if java9 + nashorn)
This commit is contained in:
@ -31,6 +31,7 @@ import java.util.Map.Entry;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.zip.*;
|
||||
import javax.imageio.ImageIO;
|
||||
@ -151,13 +152,13 @@ public class MainUtil {
|
||||
new Exception().printStackTrace();
|
||||
}
|
||||
|
||||
public static void traverse(Path path, final RunnableVal2<Path, BasicFileAttributes> onEach) {
|
||||
public static void traverse(Path path, final BiConsumer<Path, BasicFileAttributes> onEach) {
|
||||
try {
|
||||
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
|
||||
@Override
|
||||
public FileVisitResult
|
||||
visitFile(Path file, BasicFileAttributes attrs) {
|
||||
onEach.run(file, attrs);
|
||||
onEach.accept(file, attrs);
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,8 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.IntConsumer;
|
||||
import java.util.function.IntFunction;
|
||||
|
||||
public class StringMan {
|
||||
public static String replaceFromMap(final String string, final Map<String, String> replacements) {
|
||||
@ -33,6 +35,13 @@ public class StringMan {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static boolean containsAny(CharSequence sequence, String any) {
|
||||
for (int i = 0; i < sequence.length(); i++) {
|
||||
if (any.indexOf(sequence.charAt(i)) != -1) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int findMatchingBracket(CharSequence sequence, int index) {
|
||||
char startC = sequence.charAt(index);
|
||||
char lookC = getMatchingBracket(startC);
|
||||
|
@ -504,7 +504,7 @@ public class TextureUtil implements TextureHolder{
|
||||
}
|
||||
|
||||
public BiomeColor getNearestBiome(int color) {
|
||||
int grass = blockColors[2 << 4];
|
||||
int grass = blockColors[BlockTypes.GRASS_BLOCK.getInternalId()];
|
||||
if (grass == 0) {
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user