Class Helper
java.lang.Object
net.sacredlabyrinth.phaed.simpleclans.Helper
- Author:
- phaed
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringCleans up the tag from color codes and makes it lowercasestatic @Nullable StringdefaultRankFromJson(@Nullable String json) Parses the default rank from the specified Json Stringstatic StringescapeQuotes(@Nullable String str) Escapes single quotesstatic @NotNull LocaleforLanguageTag(@Nullable String languageTag) static StringformatMaxInactiveDays(int max) Formats max inactive days to an infinity symbol if it's negative or 0fromArrayToList(String... values) Converts string array to ArrayList<String>, remove empty stringsfromArrayToSet(String... values) Deprecated.static String[]Converts the Permission values array to a String arraystatic StringGenerates page separator linegetClasses(String packageName) static StringgetColorName(String playerName) Get a players full color name if he is onlinestatic longgetDelayTo(int hour, int minute) Returns the delay in seconds to the specified hour and minute.static @NotNull StringgetFormattedClanStatus(Clan clan, org.bukkit.command.CommandSender sender) getPathsIn(String path, Predicate<? super Path> filter) getSubTypesOf(String packageName, Class<?> type) ranksFromJson(@Nullable String json) Parses a list of ranks from the specified Json Stringstatic StringranksToJson(List<Rank> ranks, @Nullable String defaultRank) Converts a list of ranks and the default rank to a JSON StringresignTimesFromJson(String json) Converts a JSON String to a resign times mapstatic StringresignTimesToJson(Map<String, Long> resignTimes) Converts a resign times map to a JSON Stringstatic <K,V extends Comparable<V>>
Map<K, V> sortByValue(Map<K, V> map) Sorts a Map by valuestatic List<ClanPlayer> Remove offline players from a ClanPlayer arraystatic String[]Converts ArrayList<String> to string arraystatic @Nullable StringtoLanguageTag(@Nullable Locale locale) static StringtoLocationString(org.bukkit.Location loc) Returns a prettier coordinate
-
Method Details
-
forLanguageTag
-
toLanguageTag
-
getPathsIn
-
getClasses
-
getSubTypesOf
-
ranksFromJson
Parses a list of ranks from the specified Json String- Parameters:
json- the Json String- Returns:
- a list of ranks or null if the JSON String is null/empty
-
defaultRankFromJson
Parses the default rank from the specified Json String- Parameters:
json- the Json String- Returns:
- the default rank or null if not found and/or it does not exist
-
ranksToJson
Converts a list of ranks and the default rank to a JSON String- Parameters:
ranks- the ranksdefaultRank- the default rank- Returns:
- a JSON String
-
resignTimesToJson
Converts a resign times map to a JSON String- Parameters:
resignTimes- the resign times- Returns:
- a JSON String
-
resignTimesFromJson
Converts a JSON String to a resign times map- Parameters:
json- JSON String- Returns:
- a map
-
getDelayTo
public static long getDelayTo(int hour, int minute) Returns the delay in seconds to the specified hour and minute.- Parameters:
hour- hourminute- minute- Returns:
- the delay in seconds
-
getColorName
Get a players full color name if he is online- Parameters:
playerName-- Returns:
-
fromArrayToList
Converts string array to ArrayList<String>, remove empty strings- Parameters:
values-- Returns:
-
fromArrayToSet
Deprecated.Converts string array to HashSet<String>, remove empty strings- Parameters:
values-- Returns:
-
toArray
Converts ArrayList<String> to string array- Parameters:
list-- Returns:
-
fromPermissionArray
Converts the Permission values array to a String array- Returns:
-
cleanTag
Cleans up the tag from color codes and makes it lowercase- Parameters:
tag-- Returns:
-
generatePageSeparator
Generates page separator line- Parameters:
sep-- Returns:
-
stripOffLinePlayers
Remove offline players from a ClanPlayer array- Parameters:
in-- Returns:
-
escapeQuotes
Escapes single quotes- Parameters:
str-- Returns:
-
toLocationString
Returns a prettier coordinate- Parameters:
loc-- Returns:
-
sortByValue
Sorts a Map by value- Parameters:
map- the Map to sort- Returns:
- the Map sorted
-
formatMaxInactiveDays
Formats max inactive days to an infinity symbol if it's negative or 0- Parameters:
max- inactive days- Returns:
- formatted message
-
getFormattedClanStatus
-