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 625fd1d6bdff..c8a4ccd5b53e 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 be61fc81c4a0..e07e16a08ed6 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 032b81672133..a7fca2ce7788 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") }