diff --git a/src/main/java/io/github/homchom/recode/mod/config/impl/StreamerModeGroup.java b/src/main/java/io/github/homchom/recode/mod/config/impl/StreamerModeGroup.java index 9815a898..245aab55 100644 --- a/src/main/java/io/github/homchom/recode/mod/config/impl/StreamerModeGroup.java +++ b/src/main/java/io/github/homchom/recode/mod/config/impl/StreamerModeGroup.java @@ -24,6 +24,7 @@ public void initialize() { modules.register(new BooleanSetting("streamerSpies", true)); modules.register(new BooleanSetting("streamerHideDMs", false)); modules.register(new BooleanSetting("streamerHidePlotAds", false)); + modules.register(new BooleanSetting("streamerHidePlotBoosts", false)); modules.register(new BooleanSetting("streamerHideBuycraftUpdate", true)); modules.register(new BooleanSetting("streamerHideSupport", true)); modules.register(new BooleanSetting("streamerHideModeration", true)); diff --git a/src/main/java/io/github/homchom/recode/mod/features/social/chat/message/LegacyMessageType.java b/src/main/java/io/github/homchom/recode/mod/features/social/chat/message/LegacyMessageType.java index 314b30ad..88e4f32e 100644 --- a/src/main/java/io/github/homchom/recode/mod/features/social/chat/message/LegacyMessageType.java +++ b/src/main/java/io/github/homchom/recode/mod/features/social/chat/message/LegacyMessageType.java @@ -8,6 +8,7 @@ public enum LegacyMessageType { // General DIRECT_MESSAGE(true), PLOT_AD(true), + PLOT_BOOST(true), // Support SUPPORT, diff --git a/src/main/java/io/github/homchom/recode/mod/features/social/chat/message/MessageCheck.java b/src/main/java/io/github/homchom/recode/mod/features/social/chat/message/MessageCheck.java index 86fb57e4..bd1e6d85 100644 --- a/src/main/java/io/github/homchom/recode/mod/features/social/chat/message/MessageCheck.java +++ b/src/main/java/io/github/homchom/recode/mod/features/social/chat/message/MessageCheck.java @@ -11,6 +11,7 @@ public abstract class MessageCheck { // General new DirectMessageCheck(), new PlotAdCheck(), + new PlotBoostCheck(), // Support new SupportCheck(), diff --git a/src/main/java/io/github/homchom/recode/mod/features/social/chat/message/checks/PlotBoostCheck.java b/src/main/java/io/github/homchom/recode/mod/features/social/chat/message/checks/PlotBoostCheck.java new file mode 100644 index 00000000..17a1082e --- /dev/null +++ b/src/main/java/io/github/homchom/recode/mod/features/social/chat/message/checks/PlotBoostCheck.java @@ -0,0 +1,34 @@ +package io.github.homchom.recode.mod.features.social.chat.message.checks; + +import io.github.homchom.recode.mod.features.social.chat.message.LegacyMessage; +import io.github.homchom.recode.mod.features.social.chat.message.LegacyMessageType; +import io.github.homchom.recode.mod.features.social.chat.message.MessageCheck; +import io.github.homchom.recode.mod.features.streamer.StreamerModeHandler; +import io.github.homchom.recode.mod.features.streamer.StreamerModeMessageCheck; + +import java.util.regex.Pattern; + +public class PlotBoostCheck extends MessageCheck implements StreamerModeMessageCheck { + + private static final Pattern PLOT_BOOST_REGEX = Pattern.compile("\n {78}\n(.+)\n {29}\u200c→ Click to join!\n {78}"); + + @Override + public LegacyMessageType getType() { + return LegacyMessageType.PLOT_BOOST; + } + + @Override + public boolean check(LegacyMessage message, String stripped) { + return PLOT_BOOST_REGEX.matcher(stripped).matches(); + } + + @Override + public void onReceive(LegacyMessage message) { + + } + + @Override + public boolean streamerHideEnabled() { + return StreamerModeHandler.hidePlotBoosts(); + } +} \ No newline at end of file diff --git a/src/main/java/io/github/homchom/recode/mod/features/streamer/StreamerModeHandler.java b/src/main/java/io/github/homchom/recode/mod/features/streamer/StreamerModeHandler.java index a6f59215..545ee0b0 100644 --- a/src/main/java/io/github/homchom/recode/mod/features/streamer/StreamerModeHandler.java +++ b/src/main/java/io/github/homchom/recode/mod/features/streamer/StreamerModeHandler.java @@ -56,6 +56,10 @@ public static boolean hidePlotAds() { return getOption("streamerHidePlotAds"); } + public static boolean hidePlotBoosts() { + return getOption("streamerHidePlotBoosts"); + } + public static boolean hideBuycraftUpdate() { return getOption("streamerHideBuycraftUpdate"); } diff --git a/src/main/resources/assets/recode/lang/en_us.json b/src/main/resources/assets/recode/lang/en_us.json index 690556b0..cc1000f8 100644 --- a/src/main/resources/assets/recode/lang/en_us.json +++ b/src/main/resources/assets/recode/lang/en_us.json @@ -217,6 +217,8 @@ "config.recode.option.streamerHideDMs.tooltip": "Hides all incoming private messages", "config.recode.option.streamerHidePlotAds": "Hide Plot Ads", "config.recode.option.streamerHidePlotAds.tooltip": "Hides plot ads and blocks it's sound", + "config.recode.option.streamerHidePlotBoosts": "Hide Plot Boosts", + "config.recode.option.streamerHidePlotBoosts.tooltip": "Hides plot boosts and blocks it's sound", "config.recode.option.streamerHideBuycraftUpdate": "Hide BuycraftX Update", "config.recode.option.streamerHideBuycraftUpdate.tooltip": "Hides the BuycraftX plugin update message", "config.recode.option.streamerHideSupport": "Hide Support",