Class SFHelpers

java.lang.Object
com.soulfiremc.server.util.SFHelpers

public final class SFHelpers extends Object
  • Field Details

    • ILLEGAL_FILE_CHARACTERS

      public static final char[] ILLEGAL_FILE_CHARACTERS
  • Method Details

    • split

      public static byte[][] split(byte[] data, byte separator)
    • parseInt

      public static OptionalInt parseInt(String s)
    • not

      public static BooleanSupplier not(BooleanSupplier supplier)
    • writeIfNeeded

      public static void writeIfNeeded(Path path, String content) throws IOException
      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

      public static <E> E getRandomEntry(List<E> list)
    • isNewer

      public static boolean isNewer(String currentVersion, String checkVersion)
    • getResourceAsString

      public static String getResourceAsString(String path)
    • getResourceAsBytes

      public static byte[] getResourceAsBytes(String path)
    • make

      public static <T> T make(T object, Consumer<? super T> consumer)
    • make

      public static <T> T make(Supplier<T> consumer)
    • stripForChat

      public static String stripForChat(String s)
    • isAllowedChatCharacter

      public static boolean isAllowedChatCharacter(char c)
    • mustSupply

      public static void mustSupply(Supplier<Runnable> supplier)
    • sanitizeFileName

      public static String sanitizeFileName(String name)
    • md5Hash

      public static byte[] md5Hash(String str)
    • awaitResultPredicate

      public static <T> Optional<T> awaitResultPredicate(Iterator<T> iterator, Predicate<T> function)
    • deleteDirectory

      public static void deleteDirectory(Path path) throws IOException
      Throws:
      IOException
    • smartMDCCloseable

      public static SafeCloseable smartMDCCloseable(String key, String val)
    • smartThreadLocalCloseable

      public static <T> SafeCloseable smartThreadLocalCloseable(ThreadLocal<T> threadLocal, T val)
    • changeExtension

      public static String changeExtension(String filename, String newExt)
    • 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)