Package com.soulfiremc.server.util
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 String
changeExtension
(String filename, String newExt) static void
deleteDirectory
(Path path) static <E> E
getRandomEntry
(List<E> list) static int
getRandomInt
(int min, int max) static byte[]
getResourceAsBytes
(String path) static String
getResourceAsString
(String path) static boolean
isAllowedChatCharacter
(char c) static boolean
static <T> T
static <T> T
static <S,
T> List <T> maxFutures
(int maxFutures, Collection<S> source, Function<S, CompletableFuture<T>> toFuture, Consumer<T> onProgress, CancellationCollector cancellationCollector) static byte[]
static void
mustSupply
(Supplier<Runnable> supplier) static net.kyori.adventure.text.Component
nativeToAdventure
(net.minecraft.network.chat.Component component) static BooleanSupplier
not
(BooleanSupplier supplier) static OptionalInt
static String
sanitizeFileName
(String name) static SafeCloseable
smartMDCCloseable
(String key, String val) static <T> SafeCloseable
smartThreadLocalCloseable
(ThreadLocal<T> threadLocal, T val) static byte[][]
split
(byte[] data, byte separator) static String
static BufferedImage
toBufferedImage
(net.minecraft.world.level.saveddata.maps.MapItemSavedData map) static void
writeIfNeeded
(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)
-