From a8c3cc7979b35ca4061864dfa4e53a503a789042 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 4 Dec 2023 11:56:56 +0100 Subject: wording and code cleanup --- src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt | 1 + .../java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt | 4 +++- src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt index 517b6e418..951638df6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt @@ -10,6 +10,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object BingoAPI { private var ranks = mapOf() var tips: Map = emptyMap() + // TODO save into storage val bingoGoals = mutableListOf() val personalGoals get() = bingoGoals.filter { it.type == GoalType.PERSONAL } val communityGoals get() = bingoGoals.filter { it.type == GoalType.COMMUNITY } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt index e0a2c7638..dc09ace95 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt @@ -18,6 +18,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.onToggle import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.SimpleTimeMark +import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeUtils @@ -219,7 +220,8 @@ class BingoCardDisplay { todo.mapTo(this) { " " + it.description } if (hiddenGoals > 0) { - add("§7+ $hiddenGoals hidden personal goals.") + val name = StringUtils.canBePlural(hiddenGoals, "goal", "goals") + add("§7+ $hiddenGoals more unknown $name.") } hasHiddenPersonalGoals = config.nextTipDuration.get() && nextTip != 7.days if (hasHiddenPersonalGoals) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index b7b263a22..8c75475c9 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -146,7 +146,10 @@ object StringUtils { } fun optionalPlural(number: Int, singular: String, plural: String) = - "${number.addSeparators()} " + if (number == 1) singular else plural + "${number.addSeparators()} " + canBePlural(number, singular, plural) + + fun canBePlural(number: Int, singular: String, plural: String) = + if (number == 1) singular else plural fun progressBar(percentage: Double, steps: Int = 24): Any { //'§5§o§2§l§m §l§m §l§m §l§m §l§m §l§m §l§m §l§m §l§m §l§m §f§l§m §l§m §l§m §l§m §l§m §l§m §l§m §l§m §l§m §l§m §l§m §l§m §l§m §l§m §l§m §r §e348,144.3§6/§e936k' -- cgit