aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/event
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-08-31 20:55:30 +0200
committerGitHub <noreply@github.com>2024-08-31 20:55:30 +0200
commit2507d18717f0477b9641fbd8c6ec163720022e6a (patch)
tree5792b907b16b58424034d6113eda857095947d86 /src/main/java/at/hannibal2/skyhanni/features/event
parent025073ba4d380d696530c28536a0667478c3ebb6 (diff)
downloadskyhanni-2507d18717f0477b9641fbd8c6ec163720022e6a.tar.gz
skyhanni-2507d18717f0477b9641fbd8c6ec163720022e6a.tar.bz2
skyhanni-2507d18717f0477b9641fbd8c6ec163720022e6a.zip
Improvement: Click on chat (#2428)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/event')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityNpc.kt17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt10
3 files changed, 20 insertions, 27 deletions
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 (?<time>.*)"
+ "§dNew Year Event!§f (?<time>.*)",
)
private var lastReminderSend = SimpleTimeMark.farPast()
@@ -63,11 +63,11 @@ object NewYearCakeReminder {
if (lastReminderSend.passedSince() < 30.seconds) return
lastReminderSend = SimpleTimeMark.now()
-
- ChatUtils.clickableChat(
+ ChatUtils.clickToActionOrDisable(
"Reminding you to grab the free New Year Cake. Click here to open the baker menu!",
- onClick = { HypixelCommands.openBaker() },
- "§eClick to run /openbaker!",
+ config::newYearCakeReminder,
+ actionName = "open the baker menu",
+ action = { HypixelCommands.openBaker() },
)
}