From 2507d18717f0477b9641fbd8c6ec163720022e6a Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sat, 31 Aug 2024 20:55:30 +0200 Subject: Improvement: Click on chat (#2428) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../hannibal2/skyhanni/config/commands/Commands.kt | 2 +- .../features/garden/composter/ComposterConfig.java | 1 + .../features/event/hoppity/HoppityEggsManager.kt | 20 +++++----- .../skyhanni/features/event/hoppity/HoppityNpc.kt | 17 +++------ .../features/event/winter/NewYearCakeReminder.kt | 10 ++--- .../skyhanni/features/fame/CityProjectFeatures.kt | 24 +++++------- .../skyhanni/features/fame/UpgradeReminder.kt | 43 +++++++++++----------- .../features/garden/composter/ComposterDisplay.kt | 9 ++--- .../chocolatefactory/ChocolateFactoryBlockOpen.kt | 7 ++-- .../ChocolateFactoryCustomReminder.kt | 9 ++--- .../ChocolateFactoryTimeTowerManager.kt | 10 ++--- .../ChocolateFactoryUpgradeWarning.kt | 7 ++-- .../inventory/experiments/GuardianReminder.kt | 6 +-- .../skyhanni/features/misc/PatcherFixes.kt | 2 +- .../java/at/hannibal2/skyhanni/utils/ChatUtils.kt | 3 +- 15 files changed, 79 insertions(+), 91 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index e9dcb2525..f132df81b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -337,7 +337,7 @@ object Commands { ) { LimboTimeTracker.printStats() } registerCommand( "shlanedetection", - "Detect a farming lane in garden", + "Detect a farming lane in the Garden", ) { FarmingLaneCreator.commandLaneDetection() } registerCommand( "shignore", diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/composter/ComposterConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/composter/ComposterConfig.java index 9712573fb..c91ffbbca 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/composter/ComposterConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/composter/ComposterConfig.java @@ -91,6 +91,7 @@ public class ComposterConfig { desc = "Warn when the Composter gets close to empty, even outside Garden." ) @ConfigEditorBoolean + // TODO rename to warnAlmostEmpty public boolean warnAlmostClose = false; @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt index fcf4b17f0..bec966128 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt @@ -251,19 +251,17 @@ object HoppityEggsManager { val amount = HoppityEggType.resettingEntries.size val message = "All $amount Hoppity Eggs are ready to be found!" if (config.warpUnclaimedEggs) { - if (LorenzUtils.inSkyBlock) { - ChatUtils.clickableChat( - message, - onClick = { HypixelCommands.warp(config.warpDestination) }, - "§eClick to ${"/warp ${config.warpDestination}".trim()}!", - ) + val (action, actionName) = if (LorenzUtils.inSkyBlock) { + { HypixelCommands.warp(config.warpDestination) } to "${"warp to ${config.warpDestination}".trim()}" } else { - ChatUtils.clickableChat( - message, - onClick = { HypixelCommands.skyblock() }, - "§eClick to join /skyblock!", - ) + { HypixelCommands.skyblock() } to "join /skyblock!" } + ChatUtils.clickToActionOrDisable( + message, + config::warpUnclaimedEggs, + actionName = actionName, + action = action, + ) } else ChatUtils.chat(message) LorenzUtils.sendTitle("§e$amount Hoppity Eggs!", 5.seconds) SoundUtils.repeatSound(100, 10, SoundUtils.plingSound) diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityNpc.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityNpc.kt index 217e93bb4..70e148aa9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityNpc.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityNpc.kt @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.features.fame.ReminderUtils import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzColor @@ -53,13 +54,11 @@ object HoppityNpc { if (!HoppityAPI.isHoppityEvent()) return if (lastReminderSent.passedSince() <= 2.minutes) return - ChatUtils.clickableChat( - "New rabbits are available at §aHoppity's Shop§e! §c(Click to disable this reminder)", - onClick = { - disableReminder() - ChatUtils.chat("§eHoppity's Shop reminder disabled.") - }, - oneTimeClick = true, + ChatUtils.clickToActionOrDisable( + "New rabbits are available at §aHoppity's Shop§e!", + config::hoppityShopReminder, + actionName = "warp to hub", + action = { HypixelCommands.warp("hub") }, ) lastReminderSent = SimpleTimeMark.now() @@ -104,8 +103,4 @@ object HoppityNpc { inShop = false slotsToHighlight.clear() } - - private fun disableReminder() { - config.hoppityShopReminder = false - } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt index f64204536..785c2c358 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt @@ -24,7 +24,7 @@ object NewYearCakeReminder { private val config get() = SkyHanniMod.feature.event.winter private val sidebarDetectionPattern by RepoPattern.pattern( "event.winter.newyearcake.reminder.sidebar", - "§dNew Year Event!§f (?