From 32d3a6ae845475284cc5f72dac5649d732c223b5 Mon Sep 17 00:00:00 2001 From: raaaaaven <168305416+raaaaaven@users.noreply.github.com> Date: Sun, 28 Jul 2024 11:21:27 +0100 Subject: Feature: Thunder Bottle Charged Notification (#2234) Co-authored-by: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../features/misc/ThunderBottleNotification.kt | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/ThunderBottleNotification.kt (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderBottleNotification.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderBottleNotification.kt new file mode 100644 index 000000000..681f1a0dd --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderBottleNotification.kt @@ -0,0 +1,32 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RegexUtils.matches +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds + +@SkyHanniModule +object ThunderBottleNotification { + + private val config get() = SkyHanniMod.feature.misc + + private val thunderBottleChargedPattern by RepoPattern.pattern( + "thunderbottle.charged", + "§e> Your bottle of thunder has fully charged!", + ) + + @SubscribeEvent + fun onChat(event: LorenzChatEvent) { + if (!isEnabled()) return + + if (thunderBottleChargedPattern.matches(event.message)) { + LorenzUtils.sendTitle("§eThunder Bottle Charged!", 3.seconds) + } + } + + private fun isEnabled() = LorenzUtils.inSkyBlock && config.thunderBottleNotification +} -- cgit