diff options
author | Lorenz <ESs95s3P5z8Pheb> | 2022-07-14 00:44:01 +0200 |
---|---|---|
committer | Lorenz <ESs95s3P5z8Pheb> | 2022-07-14 00:44:01 +0200 |
commit | 544840c5d8ebbec4bfdd5d213edf1ae2099b2d14 (patch) | |
tree | 0115272eb29104ed870f38d53329d9216984a482 /src | |
parent | c09d6ee504ae43acbc7789cdbf69bc1de387bd18 (diff) | |
download | skyhanni-544840c5d8ebbec4bfdd5d213edf1ae2099b2d14.tar.gz skyhanni-544840c5d8ebbec4bfdd5d213edf1ae2099b2d14.tar.bz2 skyhanni-544840c5d8ebbec4bfdd5d213edf1ae2099b2d14.zip |
add dungeon boss message hider
Diffstat (limited to 'src')
4 files changed, 57 insertions, 31 deletions
diff --git a/src/main/java/at/lorenz/mod/LorenzMod.java b/src/main/java/at/lorenz/mod/LorenzMod.java index 4a12e16db..2ffcbc468 100644 --- a/src/main/java/at/lorenz/mod/LorenzMod.java +++ b/src/main/java/at/lorenz/mod/LorenzMod.java @@ -67,6 +67,7 @@ public class LorenzMod { MinecraftForge.EVENT_BUS.register(new DungeonMilestoneDisplay()); MinecraftForge.EVENT_BUS.register(new DungeonDeathCounter()); MinecraftForge.EVENT_BUS.register(new DungeonCleanEnd()); + MinecraftForge.EVENT_BUS.register(new DungeonBossMessages()); Commands.init(); diff --git a/src/main/java/at/lorenz/mod/config/Features.java b/src/main/java/at/lorenz/mod/config/Features.java index 20b9ecad8..2cc8f6535 100644 --- a/src/main/java/at/lorenz/mod/config/Features.java +++ b/src/main/java/at/lorenz/mod/config/Features.java @@ -118,6 +118,11 @@ public class Features { @ConfigOption(name = "Dungeon Filter", desc = "Hide annoying messages inside dungeon.") @ConfigEditorBoolean public boolean dungeonMessages = false; + + @Expose + @ConfigOption(name = "Dungeon Boss Messages", desc = "Hide messages from watcher and bosses inside dungeon.") + @ConfigEditorBoolean + public boolean dungeonBossMessages = false; } public static class Dungeon { diff --git a/src/main/java/at/lorenz/mod/dungeon/DungeonBossMessages.kt b/src/main/java/at/lorenz/mod/dungeon/DungeonBossMessages.kt new file mode 100644 index 000000000..43c66e59c --- /dev/null +++ b/src/main/java/at/lorenz/mod/dungeon/DungeonBossMessages.kt @@ -0,0 +1,51 @@ +package at.lorenz.mod.dungeon + +import at.lorenz.mod.LorenzMod +import at.lorenz.mod.events.LorenzChatEvent +import at.lorenz.mod.utils.LorenzUtils +import at.lorenz.mod.utils.LorenzUtils.matchRegex +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class DungeonBossMessages { + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!LorenzUtils.inSkyblock) return + + if (!LorenzMod.feature.chat.dungeonBossMessages) return + + if (isBoss(event.message)) { + event.blockedReason = "dungeon_boss" + } + } + + private fun isBoss(message: String): Boolean { + when { + message.matchRegex("§([cd4])\\[BOSS] (.*)") -> { + when { + message.contains(" The Watcher§r§f: ") -> return true + message.contains(" Bonzo§r§f: ") -> return true + message.contains(" Scarf§r§f:") -> return true + message.contains("Professor§r§f") -> return true + message.contains(" Livid§r§f: ") || message.contains(" Enderman§r§f: ") -> return true + message.contains(" Thorn§r§f: ") -> return true + message.contains(" Sadan§r§f: ") -> return true + message.contains(" Maxor§r§c: ") -> return true + message.contains(" Storm§r§c: ") -> return true + message.contains(" Goldor§r§c: ") -> return true + message.contains(" Necron§r§c: ") -> return true + message.contains(" §r§4§kWither King§r§c:") -> return true + + message.endsWith(" Necron§r§c: That is enough, fool!") -> return true + message.endsWith(" Necron§r§c: Adventurers! Be careful of who you are messing with..") -> return true + message.endsWith(" Necron§r§c: Before I have to deal with you myself.") -> return true + } + } + + //M7 - Dragons + message == "§cThe Crystal withers your soul as you hold it in your hands!" -> return true + message == "§cIt doesn't seem like that is supposed to go there." -> return true + } + return false + } +}
\ No newline at end of file diff --git a/src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt b/src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt index bdf0addb4..65a187816 100644 --- a/src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt +++ b/src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt @@ -38,7 +38,6 @@ class DungeonChatFilter { isDamage(message) -> "damage" isAbility(message) -> "ability" isPuzzle(message) -> "puzzle" - isBoss(message) -> "boss" isEnd(message) -> "end" else -> "" @@ -47,36 +46,6 @@ class DungeonChatFilter { private fun isDoor(message: String): Boolean = message == "§cThe §r§c§lBLOOD DOOR§r§c has been opened!" - private fun isBoss(message: String): Boolean { - when { - message.matchRegex("§([cd4])\\[BOSS] (.*)") -> { - when { - message.contains(" The Watcher§r§f: ") -> return true - message.contains(" Bonzo§r§f: ") -> return true - message.contains(" Scarf§r§f:") -> return true - message.contains("Professor§r§f") -> return true - message.contains(" Livid§r§f: ") || message.contains(" Enderman§r§f: ") -> return true - message.contains(" Thorn§r§f: ") -> return true - message.contains(" Sadan§r§f: ") -> return true - message.contains(" Maxor§r§c: ") -> return true - message.contains(" Storm§r§c: ") -> return true - message.contains(" Goldor§r§c: ") -> return true - message.contains(" Necron§r§c: ") -> return true - message.contains(" §r§4§kWither King§r§c:") -> return true - - message.endsWith(" Necron§r§c: That is enough, fool!") -> return true - message.endsWith(" Necron§r§c: Adventurers! Be careful of who you are messing with..") -> return true - message.endsWith(" Necron§r§c: Before I have to deal with you myself.") -> return true - } - } - - //M7 - Dragons - message == "§cThe Crystal withers your soul as you hold it in your hands!" -> return true - message == "§cIt doesn't seem like that is supposed to go there." -> return true - } - return false - } - private fun isEnd(message: String): Boolean = when { message.matchRegex("(.*) §r§eunlocked §r§d(.*) Essence §r§8x(.*)§r§e!") -> true message.matchRegex(" §r§d(.*) Essence §r§8x(.*)") -> true |