Use context for filter instead of moderation option

This commit is contained in:
Draycia committed 2020-07-30 23:38:20 -07:00
1 parent 88af664e61
commit f22003b6e0
3 files changed
+5 -4

No files matched your search

+3
View File
@@ -33,6 +33,9 @@ default:
# towny-town only works when the CarbonChatTowny addon is installed.
# Requires both players to be in the same town to see the message.
towny-town: false
# filter only works when CarbonChatModeration is installed.
# Modifies / prevents messages depending on how filters are setup.
filter: true
color: '#FFFFFF'
# Can players /toggle this channel and hide its messages?
ignorable: true
@@ -50,9 +50,9 @@ public class FilterHandler implements Listener {
}
private boolean channelUsesFilter(ChatChannel chatChannel) {
List<String> channels = moderation.getConfig().getStringList("filters.channels");
Object filter = chatChannel.getContext("filter");
return channels.contains("*") || channels.contains(chatChannel.getKey());
return filter instanceof Boolean && ((Boolean) filter);
}
}
@@ -18,8 +18,6 @@ filters:
# Anything in blocked-words will prevent the message from being sent at all.
blocked-words:
- "pineapple doesn't belong on pizza"
channels:
- '*' # Use '*' to mean all channels
clear-chat:
# The message sent to clear chat, you probably want to leave this blank