From eaaacb33b7164c6304add968d9a442dea1059fd2 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Sat, 4 May 2024 23:23:43 +1000 Subject: Fix: Pluralize negative changes (#1686) --- src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt') 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 } -- cgit