Class SFHelpers
java.lang.Object
com.soulfiremc.server.util.SFHelpers
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Optional<T> awaitResultPredicate(Iterator<T> iterator, Predicate<T> function) static StringchangeExtension(String filename, String newExt) static voiddeleteDirectory(Path path) static <E> EgetRandomEntry(List<E> list) static intgetRandomInt(int min, int max) static byte[]getResourceAsBytes(String path) static StringgetResourceAsString(String path) static booleanisAllowedChatCharacter(char c) static booleanstatic <T> Tstatic <T> Tstatic <S,T> List <T> maxFutures(int maxFutures, Collection<S> source, Function<S, CompletableFuture<T>> toFuture, Consumer<T> onProgress, CancellationCollector cancellationCollector) static byte[]static voidmustSupply(Supplier<Runnable> supplier) static net.kyori.adventure.text.ComponentnativeToAdventure(net.minecraft.network.chat.Component component) static BooleanSuppliernot(BooleanSupplier supplier) static OptionalIntstatic StringsanitizeFileName(String name) static SafeCloseablesmartMDCCloseable(String key, String val) static <T> SafeCloseablesmartThreadLocalCloseable(ThreadLocal<T> threadLocal, T val) static byte[][]split(byte[] data, byte separator) static Stringstatic BufferedImagetoBufferedImage(net.minecraft.world.level.saveddata.maps.MapItemSavedData map) static voidwriteIfNeeded(Path path, String content)
-
Field Details
-
ILLEGAL_FILE_CHARACTERS
public static final char[] ILLEGAL_FILE_CHARACTERS
-
-
Method Details
-
split
public static byte[][] split(byte[] data, byte separator) -
parseInt
-
not
-
writeIfNeeded
- Throws:
IOException
-
maxFutures
public static <S,T> List<T> maxFutures(int maxFutures, Collection<S> source, Function<S, CompletableFuture<T>> toFuture, Consumer<T> onProgress, CancellationCollector cancellationCollector) -
getRandomInt
public static int getRandomInt(int min, int max) -
getRandomEntry
-
isNewer
-
getResourceAsString
-
getResourceAsBytes
-
make
-
make
-
stripForChat
-
isAllowedChatCharacter
public static boolean isAllowedChatCharacter(char c) -
mustSupply
-
sanitizeFileName
-
md5Hash
-
awaitResultPredicate
-
deleteDirectory
- Throws:
IOException
-
smartMDCCloseable
-
smartThreadLocalCloseable
-
changeExtension
-
toBufferedImage
public static BufferedImage toBufferedImage(net.minecraft.world.level.saveddata.maps.MapItemSavedData map) -
nativeToAdventure
public static net.kyori.adventure.text.Component nativeToAdventure(net.minecraft.network.chat.Component component)
-