aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-07-31 23:33:07 +0200
committerGitHub <noreply@github.com>2024-07-31 23:33:07 +0200
commit9329efdc7aa23e83b2c541ea30d21b7d281c040e (patch)
treec9cc9fce5eab52ab6799652bff4c2eabe8a29e3b /src/main/java
parentd7e80759a90dd6c4b36a370113e2c81e78601dc6 (diff)
downloadskyhanni-9329efdc7aa23e83b2c541ea30d21b7d281c040e.tar.gz
skyhanni-9329efdc7aa23e83b2c541ea30d21b7d281c040e.tar.bz2
skyhanni-9329efdc7aa23e83b2c541ea30d21b7d281c040e.zip
Backend: Add cache powder chat filter (#2276)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt
index 1d414cea4..63d6dc11d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt
@@ -13,12 +13,16 @@ import at.hannibal2.skyhanni.config.features.chat.PowderMiningFilterConfig.Simpl
import at.hannibal2.skyhanni.config.features.chat.PowderMiningFilterConfig.SimplePowderMiningRewardTypes.WISHING_COMPASS
import at.hannibal2.skyhanni.config.features.chat.PowderMiningFilterConfig.SimplePowderMiningRewardTypes.YOGGIE
import at.hannibal2.skyhanni.config.features.chat.PowderMiningGemstoneFilterConfig.GemstoneFilterEntry
+import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.RegexUtils.groupOrNull
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
+import net.minecraftforge.fml.common.eventhandler.EventPriority
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.regex.Pattern
@SkyHanniModule
object PowderMiningChatFilter {
@@ -289,8 +293,11 @@ object PowderMiningChatFilter {
return null
}
- private fun blockSimpleRewards(ssMessage: String): String? {
- val rewardPatterns = mapOf(
+ var rewardPatterns: Map<Pair<Pattern, PowderMiningFilterConfig.SimplePowderMiningRewardTypes>, String> = emptyMap()
+
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
+ fun onRepoReload(event: RepositoryReloadEvent) {
+ rewardPatterns = mapOf(
ascensionRopeRewardPattern to ASCENSION_ROPE to "powder_mining_ascension_rope",
wishingCompassRewardPattern to WISHING_COMPASS to "powder_mining_wishing_compass",
oilBarrelRewardPattern to OIL_BARREL to "powder_mining_oil_barrel",
@@ -302,6 +309,9 @@ object PowderMiningChatFilter {
robotPartsPattern to ROBOT_PARTS to "powder_mining_robot_parts",
treasuritePattern to TREASURITE to "powder_mining_treasurite",
)
+ }
+
+ private fun blockSimpleRewards(ssMessage: String): String? {
for ((patternToReward, returnReason) in rewardPatterns) {
if (patternToReward.first.matches(ssMessage)) {
return if (config.simplePowderMiningTypes.contains(patternToReward.second)) returnReason