Class Functions

java.lang.Object
net.minheur.potoflux.Functions

public class Functions extends Object
This class stores useful methods for all potoflux.
  • Constructor Details

    • Functions

      public Functions()
  • Method Details

    • exit

      public static void exit(int delay, int status)
      This method is used to call exiting with a delay.
      Parameters:
      delay - amount of milliseconds before exiting
      status - exit code
    • removeProhibitedChar

      public static String removeProhibitedChar(String s)
      Method to remove all characters that could be dangerous in a String inputted by the user
      Parameters:
      s - the String to check
      Returns:
      the checked String
    • escapeHtml

      public static String escapeHtml(String s)
      Method to remove characters used in HTML code from a String
      Parameters:
      s - the String to check
      Returns:
      the checked String
    • listResourceFiles

      @Deprecated(since="6.4") public static List<String> listResourceFiles(String folder) throws IOException
      Deprecated.
      Method to get a list of .txt file names from a folder in the resources path
      Parameters:
      folder - the dir to get files from
      Returns:
      a list of file names
      Throws:
      IOException - if the folder couldn't get accessed
    • formatMessage

      public static String formatMessage(String message, Object... args)
      Format a message with placeholders.
      Parameters:
      message - your initial message. Use $$ and an int to set your placeholders
      args - your placeholder's values. the first one is $$1, then $$2...
      Returns:
      the formated message
    • browse

      public static boolean browse(String url)
      Opens a directory in your file explorer
      Parameters:
      url - directory to open
      Returns:
      weather the directory got opened or if an error happened
    • openDir

      public static boolean openDir(File dir)