Package me.lokka30.levelledmobs.util
Class Utils
java.lang.Object
me.lokka30.levelledmobs.util.Utils
Holds common utilities
- Since:
- 2.5.0
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic LevelledMobSpawnReason
adaptVanillaSpawnReason
(@NotNull org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) static @NotNull String
capitalize
(@NotNull String str) Puts the string into lowercase and makes every character that starts a word a capital letter.static boolean
checkIfMobHashChanged
(@NotNull LivingEntityWrapper lmEntity) colorizeAllInList
(@NotNull List<String> oldList) static void
debugLog
(@NotNull LevelledMobs instance, @NotNull DebugType debugType, @NotNull String msg) Sends a debug message to console if enabled in settingsstatic String
displayChunkLocation
(@NotNull org.bukkit.Location location) static long
getChunkKey
(@NotNull org.bukkit.Chunk chunk) static long
getMillisecondsFromInstant
(Instant instant) static <T,
U> @NotNull Map.Entry<T, U> getPair
(T first, U second) static @NotNull PlayerNetherOrWorldSpawnResult
getPortalOrWorldSpawn
(@NotNull LevelledMobs main, @NotNull org.bukkit.entity.Player player) static boolean
isBiomeInModalList
(@NotNull CachedModalList<org.bukkit.block.Biome> list, org.bukkit.block.Biome biome, RulesManager rulesManager) static boolean
isDamageCauseInModalList
(@NotNull CachedModalList<DeathCause> list, DeathCause cause) static boolean
static boolean
Check if str is an integerstatic boolean
isIntegerInModalList
(@NotNull CachedModalList<MinAndMax> list, int checkNum) static boolean
isLivingEntityInModalList
(@NotNull CachedModalList<String> list, LivingEntityWrapper lmEntity, boolean checkBabyMobs) static boolean
isNullOrEmpty
(@Nullable String str) static boolean
matchWildcardString
(@NotNull String input, @NotNull String match) static String
removeColorCodes
(@NotNull String input) replaceAllInList
(@NotNull List<String> oldList, @NotNull String replaceWhat, @NotNull String replaceTo) static @NotNull String
Replaces content of a message with case insensitivity.static double
round
(double value) Rounds value to 2 decimal points.static double
round
(double value, int digits) static @NotNull String
showLocation
(@NotNull org.bukkit.Location location)
-
Field Details
-
logger
-
oneToNine
-
-
Method Details
-
round
public static double round(double value) Rounds value to 2 decimal points.- Parameters:
value
- value to round- Returns:
- rounded value
-
round
public static double round(double value, int digits) -
replaceEx
@NotNull public static @NotNull String replaceEx(@NotNull @NotNull String message, @NotNull @NotNull String replaceWhat, @NotNull @NotNull String replaceTo) Replaces content of a message with case insensitivity.- Parameters:
message
- message that should be editedreplaceWhat
- the text to be replacedreplaceTo
- the text to replace with- Returns:
- modified message
-
isInteger
Check if str is an integer- Parameters:
str
- str to check- Returns:
- if str is an integer (e.g. "1234" = true, "hello" = false)
-
isDouble
-
isNullOrEmpty
-
replaceAllInList
-
colorizeAllInList
-
debugLog
public static void debugLog(@NotNull @NotNull LevelledMobs instance, @NotNull @NotNull DebugType debugType, @NotNull @NotNull String msg) Sends a debug message to console if enabled in settings- Parameters:
instance
- LevelledMobs classdebugType
- Reference to whereabouts the debug log is called so that it can be traced back easilymsg
- Message to help de-bugging
-
capitalize
Puts the string into lowercase and makes every character that starts a word a capital letter.e.g. from: wiTheR sKeLeTOn to: Wither Skeleton
- Parameters:
str
- string to capitalize- Returns:
- a string with each word capitalized
-
isLivingEntityInModalList
public static boolean isLivingEntityInModalList(@NotNull @NotNull CachedModalList<String> list, LivingEntityWrapper lmEntity, boolean checkBabyMobs) -
isIntegerInModalList
public static boolean isIntegerInModalList(@NotNull @NotNull CachedModalList<MinAndMax> list, int checkNum) -
isBiomeInModalList
public static boolean isBiomeInModalList(@NotNull @NotNull CachedModalList<org.bukkit.block.Biome> list, org.bukkit.block.Biome biome, RulesManager rulesManager) -
isDamageCauseInModalList
public static boolean isDamageCauseInModalList(@NotNull @NotNull CachedModalList<DeathCause> list, DeathCause cause) -
getMillisecondsFromInstant
-
getPortalOrWorldSpawn
@NotNull public static @NotNull PlayerNetherOrWorldSpawnResult getPortalOrWorldSpawn(@NotNull @NotNull LevelledMobs main, @NotNull @NotNull org.bukkit.entity.Player player) -
getChunkKey
public static long getChunkKey(@NotNull @NotNull org.bukkit.Chunk chunk) -
displayChunkLocation
-
getPair
@Contract(value="_, _ -> new", pure=true) public static <T,U> @NotNull Map.Entry<T,U> getPair(T first, U second) -
adaptVanillaSpawnReason
public static LevelledMobSpawnReason adaptVanillaSpawnReason(@NotNull org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) -
matchWildcardString
-
removeColorCodes
-
showLocation
-
checkIfMobHashChanged
-