aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CrashOnDeath.kt31
2 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java
index 4a3aa732e..aff9b4964 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java
@@ -134,6 +134,11 @@ public class MiscConfig {
@FeatureToggle
public boolean brewingStandOverlay = true;
+ @Expose
+ @ConfigOption(name = "Crash On Death", desc = "Crashes your game every time you die in Skyblock")
+ @ConfigEditorBoolean
+ public boolean crashOnDeath = false;
+
// TODO move into scoreboard accordion
@Expose
@ConfigOption(name = "Red Scoreboard Numbers", desc = "Hide the red scoreboard numbers on the right side of the screen.")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CrashOnDeath.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CrashOnDeath.kt
new file mode 100644
index 000000000..33d293e5b
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CrashOnDeath.kt
@@ -0,0 +1,31 @@
+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.minecraft.client.Minecraft
+import net.minecraft.crash.CrashReport
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@SkyHanniModule
+object CrashOnDeath {
+ private val config get() = SkyHanniMod.feature.misc
+
+ private val pattern by RepoPattern.pattern(
+ "ownplayer.death.chat",
+ "§c ☠ §r§7You (?<reason>.+)",
+ )
+
+ @SubscribeEvent
+ fun onChat(event: LorenzChatEvent) {
+ if (!isEnabled()) return
+
+ if (pattern.matches(event.message)) {
+ Minecraft.getMinecraft().crashed(CrashReport("Not Reading", Throwable("Don't toggle all the Options")))
+ }
+ }
+ private fun isEnabled() = LorenzUtils.inSkyBlock && config.crashOnDeath
+}