From 132633476381c7a0e6c5211837f9cff8171c3c3b Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 26 Dec 2023 21:53:44 +0100 Subject: fixed error --- .../at/hannibal2/skyhanni/features/fishing/FishingTimer.kt | 2 +- .../skyhanni/features/fishing/tracker/SeaCreatureTracker.kt | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt index 79fdc21f3..8f6988de7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt @@ -136,7 +136,7 @@ class FishingTimer { val barnTimerAlertTime = config.alertTime * 1_000 val color = if (duration > barnTimerAlertTime) "§c" else "§e" val timeFormat = TimeUtils.formatDuration(duration, biggestUnit = TimeUnit.MINUTE) - val name = StringUtils.optionalPlural(currentCount, "sea creature", "sea creatures") + val name = StringUtils.canBePlural(currentCount, "sea creature", "sea creatures") val text = "$color$timeFormat §8(§e$currentCount §b$name§8)" config.pos.renderString(text, posLabel = "BarnTimer") diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt index 1dfd03e79..6a1e1a382 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt @@ -114,6 +114,12 @@ object SeaCreatureTracker { ) } + return if (currentCategory == nameAll) { + { true } + } else filterCurrentCategory() + } + + private fun filterCurrentCategory(): (String) -> Boolean { val items = SeaCreatureManager.allVariants[currentCategory] ?: run { ErrorManager.logErrorStateWithData( "Sea Creature Tracker can not find all sea creature variants", @@ -123,12 +129,7 @@ object SeaCreatureTracker { ) return { true } } - val filter: (String) -> Boolean = if (currentCategory == nameAll) { - { true } - } else { - { it in items } - } - return filter + return { it in items } } @SubscribeEvent -- cgit