Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Crash Game On Death #2238

Merged
merged 5 commits into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ 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
@FeatureToggle
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
33 changes: 33 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,33 @@
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
}
Loading