mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
some minor refactoring
This commit is contained in:
@ -93,7 +93,7 @@ public final class BrushCache {
|
||||
} else {
|
||||
displayMap = ReflectionUtils.getMap(display.getValue());
|
||||
}
|
||||
displayMap.put("Lore", FaweCache.asTag(json.split("\\r?\\n")));
|
||||
displayMap.put("Lore", FaweCache.IMP.asTag(json.split("\\r?\\n")));
|
||||
String primary = (String) tool.getPrimary().getSettings().get(BrushSettings.SettingType.BRUSH);
|
||||
String secondary = (String) tool.getSecondary().getSettings().get(BrushSettings.SettingType.BRUSH);
|
||||
if (primary == null) primary = secondary;
|
||||
|
@ -5,6 +5,11 @@ import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.IntFunction;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public final class IOUtil {
|
||||
|
||||
@ -79,4 +84,30 @@ public final class IOUtil {
|
||||
out.write(buf, 0, r);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> Supplier<T> supplier(IntFunction<T> funx, int size) {
|
||||
return () -> funx.apply(size);
|
||||
}
|
||||
|
||||
public static <T> Supplier<T> supplier(Supplier<T> supplier, Function<T, T> modifier) {
|
||||
return () -> modifier.apply(supplier.get());
|
||||
}
|
||||
|
||||
public static <T> Supplier<T> supplier(Supplier<T> supplier, Consumer<T> modifier) {
|
||||
return () -> {
|
||||
T instance = supplier.get();
|
||||
modifier.accept(instance);
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
|
||||
public static <T> Supplier<T> supplier(Callable<T> callable) {
|
||||
return () -> {
|
||||
try {
|
||||
return callable.call();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user