Class Utils
java.lang.Object
me.remigio07.chatplugin.api.common.util.Utils
me.remigio07.chatplugin.api.server.util.Utils
Server utils class.
-
Field Summary
Fields inherited from class me.remigio07.chatplugin.api.common.util.Utils
IPV4_PATTERN, MAIN_FOLDER, NIL_UUID, NOT_APPLICABLE, SECONDS_IN_A_DAY, SECONDS_IN_A_MINUTE, SECONDS_IN_A_MONTH, SECONDS_IN_A_WEEK, SECONDS_IN_A_YEAR, SECONDS_IN_AN_HOUR, STRING_NOT_FOUND, USER_AGENT, USERNAME_PATTERN
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
deserializeSpongeText
(org.spongepowered.api.text.Text input) Deserializes the specified input to a plain text.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.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.static int
getOnlineWorld
(String world) Gets the online players in the specified world.Gets a list of the worlds' names.static org.spongepowered.api.text.Text
serializeSpongeText
(String input, boolean translate) Serializes the specified input to a Sponge-compatible text.Methods inherited from class me.remigio07.chatplugin.api.common.util.Utils
addAndGet, arrayContains, arrayIndexOf, capitalizeEveryWord, formatBalance, getFreeStorage, getInetAddress, getListFromString, getMaxPlayers, getOriginalClass, getStringFromList, getTime, getTime, getTotalStorage, integerListToStringList, isFloat, isInteger, isLong, isNumber, isPositiveInteger, isPositiveLong, isValidIPv4, isValidUsername, kilometersToMiles, kilometersToNauticalMiles, numberListToIntegerList, removeAndGet, removeFromArray, replaceCustomPlaceholders, replaceNumericPlaceholders, reverse, truncate
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
getWorlds
Gets a list of the worlds' names.- Returns:
- Worlds' names
-
getOnlineWorld
Gets the online players in the specified world.- Parameters:
world
- World to check- Returns:
- Online players
-
formatDate
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 formatlanguage
- Language used to translate the dateformat
- 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 formatlanguage
- Language used to translate the timeeverInsteadOfNever
- Whether to use "timestamps.ever" instead of "timestamps.never"useZeroSecondsInstead
- Whether to use "0s" instead of "timestamps.ever"- Returns:
- Formatted time
-
serializeSpongeText
Serializes the specified input to a Sponge-compatible text.- Parameters:
input
- Input texttranslate
- Whether toChatColor.translate(String)
the text- Returns:
- Sponge-compatible text
-
deserializeSpongeText
Deserializes the specified input to a plain text.- Parameters:
input
- Sponge-compatible text- Returns:
- Plain text
-