Skip to content

Commit 954c485

Browse files
Tell staff what the match of antiswear was
1 parent b3a4800 commit 954c485

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/main/java/parallelmc/parallelutils/modules/parallelchat/events/OnChatMessage.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,25 @@ public void onChatMessage(AsyncChatEvent event) {
104104
// Note, this may do funky things with word boundaries.
105105
// Regex can specify \b to look for a word boundary specifically
106106
//if (ParallelChat.get().bannedWords.stream().anyMatch(x -> checkSlurs.matches("(?s).*" + x + ".*"))) {
107-
if (ParallelChat.get().bannedWords.stream().anyMatch(checkSlurs::contains)) {
108-
if (ParallelChat.get().allowedWords.stream().noneMatch(checkSlurs::contains)) {
109-
event.setCancelled(true);
110-
ParallelChat.sendParallelMessageTo(player, "Please do not say that in chat.");
111-
Component slurMsg = MiniMessage.get().parse("<gray>[Anti-Swear]: ").append(event.message());
112-
for (Player p : server.getOnlinePlayers()) {
113-
if (p.hasPermission("parallelutils.notify.antislur")) {
114-
p.sendMessage(slurMsg);
107+
for (String x : ParallelChat.get().bannedWords) {
108+
if (checkSlurs.contains(x)) {
109+
if (ParallelChat.get().allowedWords.stream().noneMatch(checkSlurs::contains)) {
110+
event.setCancelled(true);
111+
ParallelChat.sendParallelMessageTo(player, "Please do not say that in chat.");
112+
Component slurMsg = MiniMessage.get().parse("<gray>[Anti-Swear]: ").append(event.message())
113+
.append(Component.text(" | Match: " + x));
114+
for (Player p : server.getOnlinePlayers()) {
115+
if (p.hasPermission("parallelutils.notify.antislur")) {
116+
p.sendMessage(slurMsg);
117+
}
115118
}
119+
return;
116120
}
117-
return;
118121
}
119122
}
120123
}
121124

125+
122126
// Anti-Caps
123127
if (ParallelChat.get().capsEnabled && !player.hasPermission("parallelutils.bypass.anticaps")) {
124128
if (msgStr.length() >= ParallelChat.get().capsMinMsgLength) {

0 commit comments

Comments
 (0)