diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/event/winter/WinterConfig.java | 6 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/winter/ReindrakeWarpHelper.kt | 42 |
2 files changed, 48 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/winter/WinterConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/winter/WinterConfig.java index 837f4c7ea..550ceaeee 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/event/winter/WinterConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/winter/WinterConfig.java @@ -46,4 +46,10 @@ public class WinterConfig { @FeatureToggle public boolean newYearCakeReminder = true; + @Expose + @ConfigOption(name = "Reindrake Warp Helper", desc = "Sends a clickable message in chat to warp to the Winter Island spawn when a Reindrake spawns.") + @ConfigEditorBoolean + @FeatureToggle + public boolean reindrakeWarpHelper = true; + } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/winter/ReindrakeWarpHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/winter/ReindrakeWarpHelper.kt new file mode 100644 index 000000000..7131426d4 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/event/winter/ReindrakeWarpHelper.kt @@ -0,0 +1,42 @@ +package at.hannibal2.skyhanni.features.event.winter + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.HypixelCommands +import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.RegexUtils.matches +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +@SkyHanniModule +object ReindrakeWarpHelper { + + private val config get() = SkyHanniMod.feature.event.winter + + private val patternGroup = RepoPattern.group("event.winter.reindrakewarphelper") + + /** + * REGEX-TEST: §c§lWOAH! §cA §4Reindrake §cwas summoned from the depths! + */ + private val spawnPattern by patternGroup.pattern( + "spawn.message", + "§c§lWOAH! §cA §4Reindrake §cwas summoned from the depths!", + ) + + @SubscribeEvent + fun onMessage(event: LorenzChatEvent) { + if (!isEnabled()) return + if (!spawnPattern.matches(event.message)) return + ChatUtils.clickToActionOrDisable( + "A Reindrake was detected. Click to warp to the Winter Island spawn!", + config::reindrakeWarpHelper, + actionName = "warp to winter island spawn", + action = { HypixelCommands.warp("winter") } + ) + } + + fun isEnabled() = IslandType.WINTER.isInIsland() && config.reindrakeWarpHelper +} |