Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

hide plot boosts in streamer mode #76

Merged
merged 1 commit into from
Mar 17, 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 @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public enum LegacyMessageType {
// General
DIRECT_MESSAGE(true),
PLOT_AD(true),
PLOT_BOOST(true),

// Support
SUPPORT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public abstract class MessageCheck {
// General
new DirectMessageCheck(),
new PlotAdCheck(),
new PlotBoostCheck(),

// Support
new SupportCheck(),
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/recode/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading