Package me.lokka30.levelledmobs.util
Class Utils
java.lang.Object
me.lokka30.levelledmobs.util.Utils
Holds common utilities
- Since:
- 2.5.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic LevelledMobSpawnReasonadaptVanillaSpawnReason(@NotNull org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) static @NotNull Stringcapitalize(@NotNull String str) Puts the string into lowercase and makes every character that starts a word a capital letter.static booleancheckIfMobHashChanged(@NotNull LivingEntityWrapper lmEntity) colorizeAllInList(@NotNull List<String> oldList) static voiddebugLog(@NotNull LevelledMobs instance, @NotNull DebugType debugType, @NotNull String msg) Sends a debug message to console if enabled in settingsstatic StringdisplayChunkLocation(@NotNull org.bukkit.Location location) static longgetChunkKey(@NotNull org.bukkit.Chunk chunk) static longgetMillisecondsFromInstant(Instant instant) static <T,U> @NotNull Map.Entry<T, U> getPair(T first, U second) static @NotNull PlayerNetherOrWorldSpawnResultgetPortalOrWorldSpawn(@NotNull LevelledMobs main, @NotNull org.bukkit.entity.Player player) static booleanisBiomeInModalList(@NotNull CachedModalList<org.bukkit.block.Biome> list, org.bukkit.block.Biome biome, RulesManager rulesManager) static booleanisDamageCauseInModalList(@NotNull CachedModalList<DeathCause> list, DeathCause cause) static booleanstatic booleanCheck if str is an integerstatic booleanisIntegerInModalList(@NotNull CachedModalList<MinAndMax> list, int checkNum) static booleanisLivingEntityInModalList(@NotNull CachedModalList<String> list, LivingEntityWrapper lmEntity, boolean checkBabyMobs) static booleanisNullOrEmpty(@Nullable String str) static booleanmatchWildcardString(@NotNull String input, @NotNull String match) static StringremoveColorCodes(@NotNull String input) replaceAllInList(@NotNull List<String> oldList, @NotNull String replaceWhat, @NotNull String replaceTo) static @NotNull StringReplaces content of a message with case insensitivity.static doubleround(double value) Rounds value to 2 decimal points.static doubleround(double value, int digits) static @NotNull StringshowLocation(@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
-