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: New Chat Filter: Factory Upgrade #1574

Merged
merged 3 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -92,6 +92,12 @@ public class FilterTypesConfig {
@FeatureToggle
public boolean diana = false;

@Expose
@ConfigOption(name = "Factory Upgrade", desc = "Hide chocolate factory upgrade and employee promotion messages.")
@ConfigEditorBoolean
@FeatureToggle
public boolean factoryUpgrade = false;

//TODO remove
@Expose
@ConfigOption(name = "Others", desc = "Hide other annoying messages.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@ class ChatFilter {
"§f +§r§7You earned §r§.* Event Silver§r§7!".toPattern(),
"§f +§r§.§k#§r§. LEVEL UP! §r§.§k#".toPattern(),
)
private val factoryUpgradePatterns = listOf(
"§.* §r§7has been promoted to §r§7\\[.*§r§7] §r§.*§r§7!".toPattern(),
"§7Your §r§aRabbit Barn §r§7capacity has been increased to §r§a.* Rabbits§r§7!".toPattern(),
"§7You will now produce §r§6.* Chocolate §r§7per click!".toPattern()
)
private val powderMiningMessages = listOf(
"§aYou uncovered a treasure chest!",
"§aYou received §r§f1 §r§aWishing Compass§r§a.",
Expand Down Expand Up @@ -380,6 +385,7 @@ class ChatFilter {
"powder_mining" to powderMiningPatterns,
"fire_sale" to fireSalePatterns,
"event" to eventPatterns,
"factory_upgrade" to factoryUpgradePatterns,
)

private val messagesMap: Map<String, List<String>> = mapOf(
Expand Down Expand Up @@ -436,6 +442,7 @@ class ChatFilter {
config.powderMining && message.isPresent("powder_mining") -> "powder_mining"
config.eventLevelUp && (message.isPresent("event") || StringUtils.isEmpty(message)) -> "event"
config.fireSale && (fireSalePattern.matches(message) || message.isPresent("fire_sale")) -> "fire_sale"
config.factoryUpgrade && message.isPresent("factory_upgrade") -> "factory_upgrade"
generalConfig.hideJacob && !GardenAPI.inGarden() && anitaFortunePattern.matches(message) -> "jacob_event"
generalConfig.hideSkyMall && !LorenzUtils.inMiningIsland() && skymallPerkPattern.matches(message) -> "skymall"

Expand Down
Loading