Skip to content

Commit

Permalink
Feature: Crash Game On Death (#2238)
Browse files Browse the repository at this point in the history
Co-authored-by: hannibal2 <[email protected]>
  • Loading branch information
Nealkitt and hannibal002 authored Jul 21, 2024
1 parent a2266a8 commit 1da1de3
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
31 changes: 31 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/features/misc/CrashOnDeath.kt
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 1da1de3

Please sign in to comment.