java.lang.Object
me.remigio07.chatplugin.api.common.util.Utils
me.remigio07.chatplugin.api.server.util.Utils

public class Utils extends Utils
Server utils class.
  • Constructor Details

    • Utils

      public Utils()
  • Method Details

    • getWorlds

      public static List<String> getWorlds()
      Gets a list of the worlds' names.
      Returns:
      Worlds' names
    • getOnlineWorld

      public static int getOnlineWorld(String world)
      Gets the online players in the specified world.
      Parameters:
      world - World to check
      Returns:
      Online players
    • formatDate

      public static String formatDate(long ms, Language language, DateFormat format)
      Formats the specified date according to one of the formats specified at "misc.simple-date-format" in the given language's messages' file.
      Parameters:
      ms - Date to format
      language - Language used to translate the date
      format - Format to use
      Returns:
      Formatted date
    • formatTime

      public static String formatTime(long totalMilliseconds, Language language, boolean everInsteadOfNever, boolean useZeroSecondsInstead)
      Formats the specified time according to the messages specified at "timestamps" in the given language's messages' file.
      Parameters:
      totalMilliseconds - Time to format
      language - Language used to translate the time
      everInsteadOfNever - Whether to use "timestamps.ever" instead of "timestamps.never"
      useZeroSecondsInstead - Whether to use "0s" instead of "timestamps.ever"
      Returns:
      Formatted time
    • serializeSpongeText

      public static org.spongepowered.api.text.Text serializeSpongeText(String input, boolean translate)
      Serializes the specified input to a Sponge-compatible text.
      Parameters:
      input - Input text
      translate - Whether to ChatColor.translate(String) the text
      Returns:
      Sponge-compatible text
    • deserializeSpongeText

      public static String deserializeSpongeText(org.spongepowered.api.text.Text input)
      Deserializes the specified input to a plain text.
      Parameters:
      input - Sponge-compatible text
      Returns:
      Plain text