Class StringUtil

java.lang.Object
com.ranull.graves.util.StringUtil

public final class StringUtil extends Object
Utility class for handling and formatting strings, including placeholders and color codes.
  • Constructor Details

    • StringUtil

      public StringUtil()
  • Method Details

    • format

      public static String format(String string)
      Formats a string by capitalizing each word and replacing underscores with spaces.
      Parameters:
      string - The string to format.
      Returns:
      The formatted string.
    • parseString

      public static String parseString(String string, Graves plugin)
    • parseString

      public static String parseString(String string, org.bukkit.entity.Entity entity, Graves plugin)
    • parseString

      public static String parseString(String string, String name, Graves plugin)
    • parseString

      public static String parseString(String string, Grave grave, Graves plugin)
    • parseString

      public static String parseString(String string, org.bukkit.Location location, Grave grave, Graves plugin)
    • parseString

      public static String parseString(String string, org.bukkit.entity.Entity entity, org.bukkit.Location location, Grave grave, Graves plugin)
    • parseString

      public static String parseString(String string, org.bukkit.entity.Entity entity, String name, org.bukkit.Location location, Grave grave, Graves plugin)
      Parses a string and replaces placeholders with corresponding values.
      Parameters:
      string - The string to parse.
      entity - The entity involved.
      name - The name to replace in the string.
      location - The location to replace in the string.
      grave - The grave object to replace in the string.
      plugin - The plugin instance.
      Returns:
      The parsed string with placeholders replaced.
    • getWorldFormatted

      private static String getWorldFormatted(String worldName, Graves plugin)
      Retrieves the formatted world name from the configuration.
      Parameters:
      worldName - the world name to look for.
      plugin - the plugin instance.
      Returns:
      the formatted world name or the original if no match is found.
    • parseTime

      @Deprecated public static String parseTime(String string, Grave grave)
      Deprecated.
      This method is deprecated and will be removed in a future version. Use getDateString(Grave, long, Graves) instead.
      Parameters:
      string - The string to parse.
      grave - The grave object.
      Returns:
      The parsed string with time placeholders replaced.
    • getDateString

      public static String getDateString(Grave grave, long time, Graves plugin)
      Gets the date string for a given time in a specific format.
      Parameters:
      grave - The grave object.
      time - The time in milliseconds.
      plugin - The plugin instance.
      Returns:
      The formatted date string.
    • getTimeString

      public static String getTimeString(Grave grave, long time, Graves plugin)
      Gets the time string for a given duration in milliseconds.
      Parameters:
      grave - The grave object.
      time - The time in milliseconds.
      plugin - The plugin instance.
      Returns:
      The formatted time string.
    • normalizeSpace

      private static String normalizeSpace(String string)
      Normalizes whitespace in a string.
      Parameters:
      string - The string to normalize.
      Returns:
      The normalized string.
    • capitalizeFully

      private static String capitalizeFully(String string)
      Capitalizes each word in a string fully.
      Parameters:
      string - The string to capitalize.
      Returns:
      The capitalized string.