diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-05-04 23:23:43 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-04 15:23:43 +0200 |
commit | eaaacb33b7164c6304add968d9a442dea1059fd2 (patch) | |
tree | 6e41afaaba09216f6f69fc979ea3db9fe5d4fd06 /src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt | |
parent | 248258f556c2f76ce8939e1eb1a57e356961c079 (diff) | |
download | skyhanni-eaaacb33b7164c6304add968d9a442dea1059fd2.tar.gz skyhanni-eaaacb33b7164c6304add968d9a442dea1059fd2.tar.bz2 skyhanni-eaaacb33b7164c6304add968d9a442dea1059fd2.zip |
Fix: Pluralize negative changes (#1686)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt | 3 |
1 files changed, 1 insertions, 2 deletions
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 } |