summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authormartimavocado <39881008+martimavocado@users.noreply.github.com>2024-03-02 22:47:42 +0000
committerGitHub <noreply@github.com>2024-03-02 23:47:42 +0100
commit0d1867cfb62a8f13345518d4b26de9bf0fecd1a4 (patch)
tree1fb6f7ab6de096bd19158ab14ecdef90b3668f2e /src/main/java/at/hannibal2/skyhanni/features
parent4abbee0b73db299d1ae31336ab9b7d6d15903016 (diff)
downloadskyhanni-0d1867cfb62a8f13345518d4b26de9bf0fecd1a4.tar.gz
skyhanni-0d1867cfb62a8f13345518d4b26de9bf0fecd1a4.tar.bz2
skyhanni-0d1867cfb62a8f13345518d4b26de9bf0fecd1a4.zip
Feature: Add more messages to chat hider (#1030)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
index e7e843e3f..12fbf7d76 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
@@ -3,14 +3,18 @@ package at.hannibal2.skyhanni.features.chat
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.features.garden.GardenAPI
+import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.matches
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.StringUtils.trimWhiteSpaceAndResets
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.regex.Pattern
class ChatFilter {
+ private val generalConfig get() = SkyHanniMod.feature.chat
private val config get() = SkyHanniMod.feature.chat.filterType
/// <editor-fold desc="Regex Patterns & Messages">
@@ -244,6 +248,7 @@ class ChatFilter {
private val annoyingSpamPatterns = listOf(
"§7Your Implosion hit (.*) for §r§c(.*) §r§7damage.".toPattern(),
"§7Your Molten Wave hit (.*) for §r§c(.*) §r§7damage.".toPattern(),
+ "§cYou need a tool with a §r§aBreaking Power §r§cof §r§6(\\d)§r§c to mine (.*)§r§c! Speak to §r§dFragilis §r§cby the entrance to the Crystal Hollows to learn more!".toPattern()
)
private val annoyingSpamMessages = listOf(
"§cThere are blocks in the way!",
@@ -256,6 +261,19 @@ class ChatFilter {
"§6§lGOOD CATCH! §r§bYou found a §r§fLight Bait§r§b.",
"§6§lGOOD CATCH! §r§bYou found a §r§aHot Bait§r§b.",
"§6§lGOOD CATCH! §r§bYou found a §r§fSpooky Bait§r§b.",
+ "§bNew day! §r§eYour §r§2Sky Mall §r§ebuff changed!",
+ "§8§oYou can disable this messaging by toggling Sky Mall in your /hotm!",
+ "§e[NPC] Jacob§f: §rMy contest has started!",
+ )
+
+ private val anitaFortunePattern by RepoPattern.pattern(
+ "chat.jacobevent.accessory",
+ "§e\\[NPC] Jacob§f: Your §9Anita's (\\w+) §fis giving you §6\\+(\\d{1,2})☘ (\\w+) Fortune §fduring the contest!"
+ )
+
+ private val skymallPerkPattern by RepoPattern.pattern(
+ "chat.skymall.perk",
+ "§eNew buff§r§r§r:(.*)"
)
// Winter Gift
@@ -395,6 +413,8 @@ class ChatFilter {
config.winterGift && message.isPresent("winter_gift") -> "winter_gift"
config.powderMining && message.isPresent("powder_mining") -> "powder_mining"
config.fireSale && message.isPresent("fire_sale") -> "fire_sale"
+ generalConfig.hideJacob && !GardenAPI.inGarden() && anitaFortunePattern.matches(message) -> "jacob_event"
+ generalConfig.hideSkyMall && !LorenzUtils.inMiningIsland() && skymallPerkPattern.matches(message) -> "skymall"
else -> ""
}