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> --- .../features/event/hoppity/HoppityEggsManager.kt | 20 +++++++++----------- .../skyhanni/features/event/hoppity/HoppityNpc.kt | 17 ++++++----------- .../features/event/winter/NewYearCakeReminder.kt | 10 +++++----- 3 files changed, 20 insertions(+), 27 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/event') 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 (?