@@ -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