diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-06-14 15:48:37 +0200 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-06-14 15:48:37 +0200 |
| commit | a996d8150ef2367e7c839f3565d60bdb68d2125d (patch) | |
| tree | 4da38c50d07b3e2cfa0352694d254225a715715e /src/main/java | |
| parent | 9f55fd15544e187491d78e2c5ecf2f2ed8ac76f1 (diff) | |
| download | skyhanni-a996d8150ef2367e7c839f3565d60bdb68d2125d.tar.gz skyhanni-a996d8150ef2367e7c839f3565d60bdb68d2125d.tar.bz2 skyhanni-a996d8150ef2367e7c839f3565d60bdb68d2125d.zip | |
Revert "creating and using Number.format()"
This reverts commit 9f55fd15544e187491d78e2c5ecf2f2ed8ac76f1.
Diffstat (limited to 'src/main/java')
49 files changed, 184 insertions, 195 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt index 64a2e9387..93870b119 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt @@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull import at.hannibal2.skyhanni.utils.NEUItems.getPrice -import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.RecalculatingValue import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TimeLimitedCache @@ -46,7 +46,7 @@ object SlayerAPI { val maxPrice = npcPrice.coerceAtLeast(price) val totalPrice = maxPrice * amount - val format = totalPrice.format() + val format = NumberUtil.format(totalPrice) val priceFormat = " §7(§6$format coins§7)" "$amountFormat$displayName$priceFormat" to totalPrice diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt index 9689481d5..d3f33a27d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt @@ -1,10 +1,10 @@ package at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.NumberUtil class CollectionStep(collectionName: String, amountNeeded: Int) : - ProgressionStep(amountNeeded.format() + " $collectionName Collection", amountNeeded.toLong()) { + ProgressionStep(NumberUtil.format(amountNeeded) + " $collectionName Collection", amountNeeded.toLong()) { val internalName by lazy { NEUInternalName.fromItemName(if (collectionName == "Mushroom") "Red Mushroom" else collectionName) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt index 9eb6483a3..864f4926d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt @@ -17,8 +17,8 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addButton +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.NumberUtil.formatLong import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.NumberUtil.roundToPrecision @@ -477,7 +477,7 @@ object BestiaryData { } private fun Long.formatNumber(): String = when (config.numberFormat) { - BestiaryConfig.NumberFormatEntry.SHORT -> this.format() + BestiaryConfig.NumberFormatEntry.SHORT -> NumberUtil.format(this) BestiaryConfig.NumberFormatEntry.LONG -> this.addSeparators() else -> "0" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt index 8f759415a..8632f9d03 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt @@ -38,7 +38,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -232,8 +231,8 @@ object DamageIndicatorManager { val currentDamage = data.damageCounter.currentDamage val currentHealing = data.damageCounter.currentHealing if (currentDamage != 0L || currentHealing != 0L) { - val formatDamage = "§c" + currentDamage.format() - val formatHealing = "§a+" + currentHealing.format() + val formatDamage = "§c" + NumberUtil.format(currentDamage) + val formatHealing = "§a+" + NumberUtil.format(currentHealing) val finalResult = if (currentHealing == 0L) { formatDamage } else if (currentDamage == 0L) { @@ -251,8 +250,8 @@ object DamageIndicatorManager { diff += 9f } for (damage in data.damageCounter.oldDamages) { - val formatDamage = "§c" + damage.damage.format() + "/s" - val formatHealing = "§a+" + damage.healing.format() + "/s" + val formatDamage = "§c" + NumberUtil.format(damage.damage) + "/s" + val formatHealing = "§a+" + NumberUtil.format(damage.healing) + "/s" val finalResult = if (damage.healing == 0L) { formatDamage } else if (damage.damage == 0L) { @@ -379,7 +378,7 @@ object DamageIndicatorManager { entityData.healthText = customHealthText } else { val color = NumberUtil.percentageColor(health, maxHealth) - entityData.healthText = color.getChatColor() + health.format() + entityData.healthText = color.getChatColor() + NumberUtil.format(health) } entityData.timeLastTick = System.currentTimeMillis() return entity.uniqueID to entityData @@ -533,7 +532,7 @@ object DamageIndicatorManager { return NumberUtil.percentageColor( calcHealth.toLong(), calcMaxHealth.toLong(), - ).getChatColor() + calcHealth.format() + ).getChatColor() + NumberUtil.format(calcHealth) } private fun checkMagmaCube( @@ -552,7 +551,7 @@ object DamageIndicatorManager { else -> { val color = NumberUtil.percentageColor(health.toLong(), 10_000_000) entityData.namePrefix = "§a6/6" - return color.getChatColor() + health.format() + return color.getChatColor() + NumberUtil.format(health) } } + " §f" @@ -596,7 +595,7 @@ object DamageIndicatorManager { if (calcHealth == -1) return null val color = NumberUtil.percentageColor(calcHealth.toLong(), maxHealth.toLong()) - return color.getChatColor() + calcHealth.format() + return color.getChatColor() + NumberUtil.format(calcHealth) } private fun checkEnderSlayer( @@ -654,7 +653,7 @@ object DamageIndicatorManager { } var result = NumberUtil.percentageColor( calcHealth.toLong(), calcMaxHealth.toLong(), - ).getChatColor() + calcHealth.format() + ).getChatColor() + NumberUtil.format(calcHealth) if (!SkyHanniMod.feature.slayer.endermen.phaseDisplay) { result = "" diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt index b9d60f507..2cac59010 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt @@ -216,13 +216,13 @@ object EnderNodeTracker { addAsSingletonList("§5§lEnder Node Tracker") addAsSingletonList("§d${data.totalNodesMined.addSeparators()} Ender Nodes mined") - addAsSingletonList("§6${lootProfit.values.sum().format()} Coins made") + addAsSingletonList("§6${format(lootProfit.values.sum())} Coins made") addAsSingletonList(" ") addAsSingletonList("§b${data.totalEndermiteNests.addSeparators()} §cEndermite Nest") for (item in EnderNode.entries.subList(0, 11)) { val count = (data.lootCount[item] ?: 0).addSeparators() - val profit = (lootProfit[item] ?: 0.0).format() + val profit = format(lootProfit[item] ?: 0.0) addAsSingletonList("§b$count ${item.displayName} §7(§6$profit§7)") } addAsSingletonList(" ") @@ -230,16 +230,16 @@ object EnderNodeTracker { val totalEnderArmor = calculateEnderArmor(data) addAsSingletonList( "§b${totalEnderArmor.addSeparators()} §5Ender Armor " + - "§7(§6${(totalEnderArmor * 10_000).format()}§7)" + "§7(§6${format(totalEnderArmor * 10_000)}§7)" ) for (item in EnderNode.entries.subList(11, 16)) { val count = (data.lootCount[item] ?: 0).addSeparators() - val profit = (lootProfit[item] ?: 0.0).format() + val profit = format(lootProfit[item] ?: 0.0) addAsSingletonList("§b$count ${item.displayName} §7(§6$profit§7)") } // enderman pet rarities val (c, u, r, e, l) = EnderNode.entries.subList(16, 21).map { (data.lootCount[it] ?: 0).addSeparators() } - val profit = EnderNode.entries.subList(16, 21).sumOf { lootProfit[it] ?: 0.0 }.format() + val profit = format(EnderNode.entries.subList(16, 21).sumOf { lootProfit[it] ?: 0.0 }) addAsSingletonList("§f$c§7-§a$u§7-§9$r§7-§5$e§7-§6$l §fEnderman Pet §7(§6$profit§7)") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt index d5e632d49..61e03cf97 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt @@ -4,8 +4,8 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.NumberUtil.roundToPrecision import io.github.moulberry.notenoughupdates.util.Utils import java.io.FileReader @@ -132,7 +132,7 @@ object GhostUtil { if (GhostCounter.config.showMax) GhostCounter.bestiaryCurrentKill.addSeparators() else currentKill.addSeparators() ) .replace("%percentNumber%", percent(GhostCounter.bestiaryCurrentKill.toDouble())) - .replace("%killNeeded%", killNeeded.format()) + .replace("%killNeeded%", NumberUtil.format(killNeeded)) .replace("%currentLevel%", currentLevel) .replace("%nextLevel%", nextLevel) .replace("&", "§") diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt index ddd59ec0c..9fe716328 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt @@ -11,8 +11,8 @@ import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matches @@ -67,7 +67,7 @@ object DianaProfitTracker { override fun getCoinName(item: TrackedItem) = "§6Dug Out Coins" override fun getCoinDescription(item: TrackedItem): List<String> { - val burrowDugCoinsFormat = item.totalAmount.format() + val burrowDugCoinsFormat = NumberUtil.format(item.totalAmount) return listOf( "§7Digging treasures gave you", "§6$burrowDugCoinsFormat coins §7in total." diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt index 8050b3471..dc0c3b6ff 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggsManager.getEggTyp import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.DelayedRun -import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.RegexUtils.groupOrNull import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.fromNow @@ -60,7 +60,7 @@ object HoppityEggsCompactChat { val mealName = lastChatMeal?.coloredName ?: "" return if (duplicate) { - val format = lastDuplicateAmount?.let { it.format() } ?: "?" + val format = lastDuplicateAmount?.let { NumberUtil.format(it) } ?: "?" val timeFormatted = lastDuplicateAmount?.let { ChocolateFactoryAPI.timeUntilNeed(it).format(maxUnits = 2) } ?: "?" diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt index 7cfbaad60..e01c0386d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt @@ -15,8 +15,8 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -154,7 +154,7 @@ object FrozenTreasureTracker { fun formatNumber(amount: Number): String { if (amount is Int) return amount.addSeparators() - if (amount is Long) return amount.format() + if (amount is Long) return NumberUtil.format(amount) return "$amount" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt index 98f2b999a..c707e2209 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt @@ -23,8 +23,8 @@ import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.NEUItems.getPrice +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.RegexUtils.matchFirst import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.RenderUtils.highlight @@ -167,7 +167,7 @@ object CityProjectFeatures { }) { inInventory && !NEUItems.neuHasFocus() }) val price = internalName.getPrice(false) * amount - val format = price.format() + val format = NumberUtil.format(price) list.add(" §7(§6$format§7)") add(list) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt index 7f0fd1c59..a9dba3cc1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt @@ -18,8 +18,8 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addButton import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -71,7 +71,7 @@ object FishingProfitTracker { override fun getCoinName(item: TrackedItem) = "§6Fished Coins" override fun getCoinDescription(item: TrackedItem): List<String> { - val mobKillCoinsFormat = item.totalAmount.format() + val mobKillCoinsFormat = NumberUtil.format(item.totalAmount) return listOf( "§7You fished up §6$mobKillCoinsFormat coins §7already." ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt index 5920ec977..e0aaa5719 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt @@ -10,8 +10,8 @@ import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getPrice +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal |
