diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolatePositionChange.kt | 3 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolatePositionChange.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolatePositionChange.kt index fc0a66786..f71a4b341 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolatePositionChange.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolatePositionChange.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.inventory.chocolatefactory import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SimpleTimeMark +import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.TimeUtils.format object ChocolatePositionChange { @@ -23,7 +24,7 @@ object ChocolatePositionChange { var message = "§b$lastLb §c-> §b$leaderboard" val change = lastPosition - position val color = if (change > 0) "§a+" else "§c" - message += "\n §7Changed by $color${change.addSeparators()} spots" + message += "\n §7Changed by $color${change.addSeparators()} ${StringUtils.pluralize(change, "spot")}" lastTime?.let { message += " §7in §b${it.passedSince().format(maxUnits = 2)}" diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index 4feb0ba13..c52927291 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -4,7 +4,6 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.mixins.transformers.AccessorChatComponentText import at.hannibal2.skyhanni.utils.GuiRenderUtils.darkenColor import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.StringUtils.width import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiUtilRenderComponents import net.minecraft.util.ChatComponentText @@ -209,7 +208,7 @@ object StringUtils { fun pluralize(number: Int, singular: String, plural: String? = null, withNumber: Boolean = false): String { val pluralForm = plural ?: "${singular}s" - var str = if (number == 1) singular else pluralForm + var str = if (number == 1 || number == -1) singular else pluralForm if (withNumber) str = "${number.addSeparators()} $str" return str } |