diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-08-13 18:19:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-13 18:19:24 +0200 |
commit | 4b2935b538b4a7b7816ac581fa184340557e66e7 (patch) | |
tree | 997affa07ee7220eb6df66933b0c6d1d0250aff7 /src/main/java | |
parent | 9f4e281457ea73a9363cdf781351ed26be6ecbfc (diff) | |
download | skyhanni-4b2935b538b4a7b7816ac581fa184340557e66e7.tar.gz skyhanni-4b2935b538b4a7b7816ac581fa184340557e66e7.tar.bz2 skyhanni-4b2935b538b4a7b7816ac581fa184340557e66e7.zip |
Improvement: Click CF block message to open pets (#2333)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java')
3 files changed, 26 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBlockOpen.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBlockOpen.kt index 625fd1d6b..c8a4ccd5b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBlockOpen.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBlockOpen.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.MessageSendToServerEvent import at.hannibal2.skyhanni.features.event.hoppity.MythicRabbitPetWarning import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -39,10 +40,13 @@ object ChocolateFactoryBlockOpen { commandSentTimer = SimpleTimeMark.now() event.cancel() - ChatUtils.chatAndOpenConfig( - "Blocked opening the Chocolate Factory without a §dMythic Rabbit Pet §eequipped. Click here to disable!", + ChatUtils.clickToActionOrDisable( + "§cBlocked opening the Chocolate Factory without a §dMythic Rabbit Pet §cequipped!", config::mythicRabbitRequirement, - ) + "open pets menu", + ) { + HypixelCommands.pet() + } } private fun isEnabled() = LorenzUtils.inSkyBlock && config.mythicRabbitRequirement diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt index be61fc81c..e07e16a08 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt @@ -257,4 +257,19 @@ object ChatUtils { } return this } + + fun clickToActionOrDisable(message: String, option: KMutableProperty0<*>, actionName: String, action: () -> Unit) { + ChatUtils.clickableChat( + "$message\n§e[CLICK to $actionName or disable this feature]", + onClick = { + if (KeyboardManager.isShiftKeyDown() || KeyboardManager.isModifierKeyDown()) { + option.jumpToEditor() + } else { + action() + } + }, + hover = "§eClick to $actionName!\n" + + "§eShift-Click to disable this feature!", + ) + } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt b/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt index 032b81672..a7fca2ce7 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/HypixelCommands.kt @@ -68,6 +68,10 @@ object HypixelCommands { send("cf") } + fun pet() { + send("pet") + } + fun openBaker() { send("openbaker") } |