From 24b0c5f7313fd3f91e4f6e7686b6bac8c38d7750 Mon Sep 17 00:00:00 2001 From: alexia Date: Fri, 16 Feb 2024 08:55:11 +0100 Subject: Clean up string pluralization methods. #975 --- .../skyhanni/features/garden/farming/FarmingWeightDisplay.kt | 4 ++-- .../java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt | 4 ++-- .../java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index e43bbb7dd..a5fd423fb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -396,9 +396,9 @@ class FarmingWeightDisplay { if (diff == 0) return if (diff > 0) { - showLbChange("§cdropped ${StringUtils.optionalPlural(diff, "place", "places")}", oldPosition) + showLbChange("§cdropped ${StringUtils.pluralize(diff, "place", withNumber = true)}", oldPosition) } else { - showLbChange("§arisen ${StringUtils.optionalPlural(-diff, "place", "places")}", oldPosition) + showLbChange("§arisen ${StringUtils.pluralize(-diff, "place", withNumber = true)}", oldPosition) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt index 63a4b66d3..c46b73f01 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt @@ -96,7 +96,7 @@ class PestFinder { for (plot in getPlotsWithPests()) { val pests = plot.pests val plotName = plot.name - val pestsName = StringUtils.optionalPlural(pests, "pest", "pests") + val pestsName = StringUtils.pluralize(pests, "pest", withNumber = true) val renderable = Renderable.clickAndHover( "§c$pestsName §7in §b$plotName", listOf( @@ -211,7 +211,7 @@ class PestFinder { } event.renderPlot(plot, LorenzColor.GOLD.toColor(), LorenzColor.RED.toColor()) - val pestsName = StringUtils.optionalPlural(plot.pests, "pest", "pests") + val pestsName = StringUtils.pluralize(plot.pests, "pest", withNumber = true) val plotName = plot.name val middle = plot.middle val location = playerLocation.copy(x = middle.x, z = middle.z) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt index df044dbc1..bc1ae651c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt @@ -49,7 +49,7 @@ class PestSpawn { private fun pestSpawn(amount: Int, plotName: String) { PestSpawnEvent(amount, plotName).postAndCatch() - val pestName = StringUtils.canBePlural(amount, "Pest", "Pests") + val pestName = StringUtils.pluralize(amount, "Pest") val message = "§e$amount §a$pestName Spawned in §b$plotName§a!" if (config.showTitle) { -- cgit