Skip to content

Commit

Permalink
Use StringUtils' pluralize instead of a hand-rolled solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Nessiesson committed Jan 17, 2025
1 parent 995d3eb commit ba5d6e8
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.NumberUtil.fractionOf
import at.hannibal2.skyhanni.utils.NumberUtil.roundTo
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.StringUtils
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import org.lwjgl.input.Keyboard
Expand Down Expand Up @@ -43,9 +44,9 @@ object PowderPerHotmPerk {
perk.calculateTotalCost((perk.rawLevel + 10).coerceAtMost(perk.maxLevel)) - perk.calculateTotalCost(perk.rawLevel)

val numberOfLevels = (perk.maxLevel - perk.rawLevel).coerceAtMost(10)
val s = if (numberOfLevels != 1) "s" else ""
val levelsFormat = StringUtils.pluralize(numberOfLevels, "level")

event.toolTip.add(indexOfCost + 2, "§7Powder for $numberOfLevels level$s §e${powderFor10Levels.addSeparators()}")
event.toolTip.add(indexOfCost + 2, "§7Powder for $numberOfLevels $levelsFormat §e${powderFor10Levels.addSeparators()}")
}

private fun handlePowderSpend(perk: HotmData): String {
Expand Down

0 comments on commit ba5d6e8

Please sign in to comment.