aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorClicks <58398364+CuzImClicks@users.noreply.github.com>2024-09-23 16:47:07 +0200
committerGitHub <noreply@github.com>2024-09-23 16:47:07 +0200
commitf71458b10781f366d6220b662dba42abe0aa80b3 (patch)
treefc861dca649ed138090492ce03e990cd5d2ec149 /src/main
parent7c9f889efd9c5d889394f8bf00288ef1c38f8ae4 (diff)
downloadskyhanni-f71458b10781f366d6220b662dba42abe0aa80b3.tar.gz
skyhanni-f71458b10781f366d6220b662dba42abe0aa80b3.tar.bz2
skyhanni-f71458b10781f366d6220b662dba42abe0aa80b3.zip
Feature: Reindrake Warp Helper (#2569)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/event/winter/WinterConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/winter/ReindrakeWarpHelper.kt42
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
+}