Package com.ranull.graves.util
Class StringUtil
java.lang.Object
com.ranull.graves.util.StringUtil
Utility class for handling and formatting strings, including placeholders and color codes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
capitalizeFully
(String string) Capitalizes each word in a string fully.static String
Formats a string by capitalizing each word and replacing underscores with spaces.static String
getDateString
(Grave grave, long time, Graves plugin) Gets the date string for a given time in a specific format.static String
getTimeString
(Grave grave, long time, Graves plugin) Gets the time string for a given duration in milliseconds.private static String
getWorldFormatted
(String worldName, Graves plugin) Retrieves the formatted world name from the configuration.private static String
normalizeSpace
(String string) Normalizes whitespace in a string.static String
parseString
(String string, Graves plugin) static String
parseString
(String string, Grave grave, Graves plugin) static String
parseString
(String string, String name, Graves plugin) static String
parseString
(String string, org.bukkit.entity.Entity entity, Graves plugin) 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.static String
parseString
(String string, org.bukkit.entity.Entity entity, org.bukkit.Location location, Grave grave, Graves plugin) static String
parseString
(String string, org.bukkit.Location location, Grave grave, Graves plugin) static String
Deprecated.This method is deprecated and will be removed in a future version.
-
Constructor Details
-
StringUtil
public StringUtil()
-
-
Method Details
-
format
Formats a string by capitalizing each word and replacing underscores with spaces.- Parameters:
string
- The string to format.- Returns:
- The formatted string.
-
parseString
-
parseString
-
parseString
-
parseString
-
parseString
-
parseString
-
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
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.This method is deprecated and will be removed in a future version. UsegetDateString(Grave, long, Graves)
instead.- Parameters:
string
- The string to parse.grave
- The grave object.- Returns:
- The parsed string with time placeholders replaced.
-
getDateString
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
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
Normalizes whitespace in a string.- Parameters:
string
- The string to normalize.- Returns:
- The normalized string.
-
capitalizeFully
Capitalizes each word in a string fully.- Parameters:
string
- The string to capitalize.- Returns:
- The capitalized string.
-