From 0d3c6f6c95fe3574d1da5d75f344dac459a3b241 Mon Sep 17 00:00:00 2001 From: Lorenz Date: Sat, 9 Jul 2022 00:29:54 +0200 Subject: split off the chat filter settings --- src/main/java/at/lorenz/mod/chat/ChatFilter.kt | 36 +++++++------- src/main/java/at/lorenz/mod/config/Features.java | 55 +++++++++++++++++----- .../at/lorenz/mod/dungeon/DungeonChatFilter.kt | 2 +- .../skyblockhud_2/config/SBHConfigEditor.java | 3 +- 4 files changed, 63 insertions(+), 33 deletions(-) (limited to 'src/main') diff --git a/src/main/java/at/lorenz/mod/chat/ChatFilter.kt b/src/main/java/at/lorenz/mod/chat/ChatFilter.kt index be2c080bd..fed9f34b3 100644 --- a/src/main/java/at/lorenz/mod/chat/ChatFilter.kt +++ b/src/main/java/at/lorenz/mod/chat/ChatFilter.kt @@ -10,7 +10,7 @@ class ChatFilter { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzMod.feature.chat.mainFilter) return +// if (!LorenzMod.feature.chat.chatFilterAll) return val blockReason = block(event.message) if (blockReason != "") { @@ -20,23 +20,23 @@ class ChatFilter { private fun block(message: String): String = when { message.startsWith("§aYou are playing on profile: §e") -> "profile"//TODO move into own class - lobby(message) -> "lobby" - empty(message) -> "empty" - warping(message) -> "warping" - welcome(message) -> "welcome" - guild(message) -> "guild" - killCombo(message) -> "kill_combo" - bazaarAndAHMiniMessages(message) -> "bz_ah_minis" - watchdogAnnouncement(message) -> "watchdog" - slayer(message) -> "slayer" - slayerDrop(message) -> "slayer_drop" - uselessDrop(message) -> "useless_drop" - uselessNotification(message) -> "useless_notification" - party(message) -> "party" - money(message) -> "money" - winterIsland(message) -> "winter_island" - uselessWarning(message) -> "useless_warning" - friendJoin(message) -> "friend_join" + lobby(message) && LorenzMod.feature.chat.hypixelHub -> "lobby" + empty(message) && LorenzMod.feature.chat.empty -> "empty" + warping(message) && LorenzMod.feature.chat.warping -> "warping" + welcome(message) && LorenzMod.feature.chat.welcome -> "welcome" + guild(message) && LorenzMod.feature.chat.others -> "guild" + killCombo(message) && LorenzMod.feature.chat.others -> "kill_combo" + bazaarAndAHMiniMessages(message) && LorenzMod.feature.chat.others -> "bz_ah_minis" + watchdogAnnouncement(message) && LorenzMod.feature.chat.others -> "watchdog" + slayer(message) && LorenzMod.feature.chat.others -> "slayer" + slayerDrop(message) && LorenzMod.feature.chat.others -> "slayer_drop" + uselessDrop(message) && LorenzMod.feature.chat.others -> "useless_drop" + uselessNotification(message) && LorenzMod.feature.chat.others -> "useless_notification" + party(message) && LorenzMod.feature.chat.others -> "party" + money(message) && LorenzMod.feature.chat.others -> "money" + winterIsland(message) && LorenzMod.feature.chat.others -> "winter_island" + uselessWarning(message) && LorenzMod.feature.chat.others -> "useless_warning" + friendJoin(message) && LorenzMod.feature.chat.others -> "friend_join" else -> "" diff --git a/src/main/java/at/lorenz/mod/config/Features.java b/src/main/java/at/lorenz/mod/config/Features.java index 0bbac1e4a..43843df40 100644 --- a/src/main/java/at/lorenz/mod/config/Features.java +++ b/src/main/java/at/lorenz/mod/config/Features.java @@ -6,10 +6,7 @@ import com.thatgravyboat.skyblockhud_2.config.SBHConfigEditor; import com.thatgravyboat.skyblockhud_2.core.GuiElement; import com.thatgravyboat.skyblockhud_2.core.GuiScreenElementWrapper; import com.thatgravyboat.skyblockhud_2.core.config.Position; -import com.thatgravyboat.skyblockhud_2.core.config.annotations.Category; -import com.thatgravyboat.skyblockhud_2.core.config.annotations.ConfigEditorBoolean; -import com.thatgravyboat.skyblockhud_2.core.config.annotations.ConfigEditorButton; -import com.thatgravyboat.skyblockhud_2.core.config.annotations.ConfigOption; +import com.thatgravyboat.skyblockhud_2.core.config.annotations.*; import com.thatgravyboat.skyblockhud_2.core.config.gui.GuiPositionEditor; import net.minecraft.client.Minecraft; @@ -67,22 +64,54 @@ public class Features { public static class Chat { @Expose - @ConfigOption(name = "Main Chat Filter", desc = "Hides all the annoying chat messages.") + @ConfigOption(name = "Chat Filter Types", desc = "") + @ConfigEditorAccordion(id = 1) + public boolean filterTypes = false; + + + @Expose + @ConfigOption(name = "HyPixel Hub", desc = "Block messages outside SkyBlock in the HyPixel lobby: player joins, loot boxes, prototype lobby messages, radiating generosity and HyPixel tournaments.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 1) + public boolean hypixelHub = false; + + @Expose + @ConfigOption(name = "Empty", desc = "Hide all the empty messages from the chat.") @ConfigEditorBoolean - public boolean mainFilter = true; + @ConfigAccordionId(id = 1) + public boolean empty = false; + + @Expose + @ConfigOption(name = "Warping", desc = "Block 'sending request to join ..' and 'warping ..' messages.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 1) + public boolean warping = false; + + @Expose + @ConfigOption(name = "Welcome", desc = "Hide the 'welcome to skyblock' message.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 1) + public boolean welcome = false; + + //TODO remove + @Expose + @ConfigOption(name = "Others", desc = "Hide other annoying messages.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 1) + public boolean others = false; @Expose @ConfigOption(name = "Player Messages", desc = "Add a fancy new chat format for player messages.") @ConfigEditorBoolean public boolean playerMessages = false; - } - - public static class Dungeon { @Expose - @ConfigOption(name = "Hide Messages", desc = "Hide annoying dungeon messages.") + @ConfigOption(name = "Dungeon Filter", desc = "Hide annoying messages inside dungeon.") @ConfigEditorBoolean - public boolean hideAnnoyingMessages = false; + public boolean dungeonMessages = false; + } + + public static class Dungeon { @Expose @ConfigOption(name = "Clicked Blocks", desc = "Highlight the following blocks when clicked in dungeon: Lever, Chest, Wither Essence") @@ -136,7 +165,7 @@ public class Features { public static class Bazaar { @Expose - @ConfigOption(name = "Order Helper", desc = "Show visual hints when items are ready to pickup or outbid.") + @ConfigOption(name = "Order Helper", desc = "Show visual hints inside the Bazaar Manage Order view when items are ready to pickup or outbid.") @ConfigEditorBoolean public boolean orderHelper = false; } @@ -154,7 +183,7 @@ public class Features { public Position petDisplayPos = new Position(10, 10, false, true); @Expose - @ConfigOption(name = "Exp Bottles", desc = "Hides all the experience bottles laying on the ground.") + @ConfigOption(name = "Exp Bottles", desc = "Hides all the experience bottles lying on the ground.") @ConfigEditorBoolean public boolean hideExpBottles = false; } diff --git a/src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt b/src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt index 5d8b3406e..d05c480bd 100644 --- a/src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt +++ b/src/main/java/at/lorenz/mod/dungeon/DungeonChatFilter.kt @@ -10,7 +10,7 @@ class DungeonChatFilter { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzMod.feature.dungeon.hideAnnoyingMessages) return + if (!LorenzMod.feature.chat.dungeonMessages) return val blockReason = block(event.message) if (blockReason != "") { diff --git a/src/main/java/com/thatgravyboat/skyblockhud_2/config/SBHConfigEditor.java b/src/main/java/com/thatgravyboat/skyblockhud_2/config/SBHConfigEditor.java index 9f175c02d..cfe53ffe2 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud_2/config/SBHConfigEditor.java +++ b/src/main/java/com/thatgravyboat/skyblockhud_2/config/SBHConfigEditor.java @@ -2,6 +2,7 @@ package com.thatgravyboat.skyblockhud_2.config; import static com.thatgravyboat.skyblockhud_2.GuiTextures.DISCORD; +import at.lorenz.mod.LorenzMod; import at.lorenz.mod.config.Features; import com.google.common.collect.Lists; import com.thatgravyboat.skyblockhud_2.core.GlScissorStack; @@ -147,7 +148,7 @@ public class SBHConfigEditor extends GuiElement { RenderUtils.drawFloatingRectDark(x + 5, y + 5, xSize - 10, 20, false); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - TextRenderUtils.drawStringCenteredScaledMaxWidth("LorenzMod by " + EnumChatFormatting.RED + "hannibal2" + EnumChatFormatting.RESET + ", config by " + EnumChatFormatting.DARK_PURPLE + "Moulberry", fr, x + xSize / 2f, y + 15, false, 200, 0xa0a0a0); + TextRenderUtils.drawStringCenteredScaledMaxWidth("LorenzMod " + LorenzMod.VERSION +" by " + EnumChatFormatting.RED + "hannibal2" + EnumChatFormatting.RESET + ", config by " + EnumChatFormatting.DARK_PURPLE + "Moulberry", fr, x + xSize / 2f, y + 15, false, 200, 0xa0a0a0); RenderUtils.drawFloatingRectDark(x + 4, y + 49 - 20, 140, ySize - 54 + 20, false); -- cgit