diff options
author | Stella <stellaarnott1@gmail.com> | 2024-07-21 02:24:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-21 11:24:13 +0200 |
commit | 1da1de3da35f7f98f582967368be51b50278aa5b (patch) | |
tree | 547849698d0934e1e3dc02012cc80f90abdd1c20 /src/main | |
parent | a2266a87073622b6547b3704f7ad81de0f6cb5b2 (diff) | |
download | skyhanni-1da1de3da35f7f98f582967368be51b50278aa5b.tar.gz skyhanni-1da1de3da35f7f98f582967368be51b50278aa5b.tar.bz2 skyhanni-1da1de3da35f7f98f582967368be51b50278aa5b.zip |
Feature: Crash Game On Death (#2238)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java | 5 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/CrashOnDeath.kt | 31 |
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 +} |