Package co.aikar.commands
Class ACFUtil
java.lang.Object
co.aikar.commands.ACFUtil
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
capitalize
(String str, char[] delimiters) static String
capitalizeFirst
(String name) static String
capitalizeFirst
(String name, char separator) static String
static String
static String
formatNumber
(Integer balance) static <T extends Enum>
TgetEnumFromName
(T[] types, String name) static <T extends Enum>
TgetEnumFromName
(T[] types, String name, T def) static <T extends Enum>
TgetEnumFromOrdinal
(T[] types, int ordinal) static <T> T
getFirstElement
(Iterable<T> iterable) static <T> boolean
hasIntersection
(Collection<T> list1, Collection<T> list2) static int
static <T> Collection<T>
intersection
(Collection<T> list1, Collection<T> list2) static String
intToRoman
(int integer) static boolean
isBetween
(float num, double min, double max) static boolean
static boolean
static boolean
static boolean
static boolean
static String
static String
static String
static String
static String
static String
join
(Collection<String> args) static String
join
(Collection<String> args, String sep) static String
static String
static String
static <T> T
nullDefault
(Object val, Object def) static String
static String
static BigDecimal
parseBigNumber
(String num, boolean suffixes) static Double
parseDouble
(String var) static Double
parseDouble
(String var, Double def) static Float
parseFloat
(String var) static Float
parseFloat
(String var, Float def) static Integer
static Integer
static Long
static Long
static Number
parseNumber
(String num, boolean suffixes) static double
precision
(double x, int p) static <T> List<T>
preformOnImmutable
(List<T> list, Consumer<List<T>> action) static double
rand
(double min, double max) static int
rand
(int min, int max) static int
rand
(int min1, int max1, int min2, int max2) Calculate random between 2 points, excluding a center ex: Util.rand(-12, -6, 6, 12) would not return -5 to 5static boolean
randBool()
static <T extends Enum<?>>
TDeprecated.static <T> T
static <T> T
random
(T[] arr) static String
Plain String replacement.static String
Plain string replacement, escapes replace value.static String
replacePattern
(String string, String pattern, String repl) Regex version ofreplace(String, String, String)
static String
replacePattern
(String string, Pattern pattern, String repl) Regex version ofreplace(String, Pattern, String)
static String
replacePatternMatch
(String string, String pattern, String repl) Pure Regex Pattern matching and replacement, no escapingstatic String
replacePatternMatch
(String string, Pattern pattern, String repl) Pure Regex Pattern matching and replacement, no escapingstatic String
replacePatterns
(String string, String... replacements) static String
replaceStrings
(String string, String... replacements) static double
round
(double x, int scale) static int
roundUp
(int num, int multiple) static String
static <E extends Enum<E>>
EsimpleMatch
(Class<? extends Enum<?>> list, String item) static String
simplifyString
(String str) static void
static String
-
Field Details
-
RANDOM
-
-
Method Details
-
padRight
-
padLeft
-
formatNumber
-
getEnumFromName
-
getEnumFromName
-
getEnumFromOrdinal
-
ucfirst
-
parseDouble
-
parseDouble
-
parseFloat
-
parseFloat
-
parseLong
-
parseLong
-
parseInt
-
parseInt
-
randBool
-
nullDefault
-
join
-
join
-
join
-
join
-
join
-
join
-
join
-
simplifyString
-
round
-
roundUp
-
limit
-
replace
Plain string replacement, escapes replace value.- Parameters:
string
-pattern
-repl
-- Returns:
-
replacePattern
Regex version ofreplace(String, Pattern, String)
- Parameters:
string
-pattern
-repl
-- Returns:
-
replace
Plain String replacement. If you need regex patterns, seereplacePattern(String, String, String)
- Parameters:
string
-pattern
-repl
-- Returns:
-
replacePattern
Regex version ofreplace(String, String, String)
- Parameters:
string
-pattern
-repl
-- Returns:
-
replacePatternMatch
Pure Regex Pattern matching and replacement, no escaping- Parameters:
string
-pattern
-repl
-- Returns:
-
replacePatternMatch
Pure Regex Pattern matching and replacement, no escaping- Parameters:
string
-pattern
-repl
-- Returns:
-
replaceStrings
-
replacePatterns
-
capitalize
-
random
-
random
-
random
Deprecated.Added as im sure we will try to "Find this" again. This is no different than Enum.values() passed to above method logically but the array version is slightly faster.- Type Parameters:
T
-- Parameters:
enm
-- Returns:
-
normalize
-
indexOf
-
capitalizeFirst
-
capitalizeFirst
-
ltrim
-
rtrim
-
enumNames
-
enumNames
-
combine
-
combine
-
simpleMatch
@Nullable public static <E extends Enum<E>> E simpleMatch(Class<? extends Enum<?>> list, String item) -
isTruthy
-
parseNumber
-
parseBigNumber
-
hasIntersection
-
intersection
-
rand
-
rand
Calculate random between 2 points, excluding a center ex: Util.rand(-12, -6, 6, 12) would not return -5 to 5- Parameters:
min1
-max1
-min2
-max2
-- Returns:
-
rand
-
isNumber
-
intToRoman
-
isInteger
-
isFloat
-
isDouble
-
isBetween
-
precision
-
sneaky
-
preformOnImmutable
-
getFirstElement
-