@@ -111,13 +111,16 @@ public static boolean unicode(InfractionPlayer player, AtomicReference<String> s
111111 plugin .getLogger ().error ("An Error ocurred on Unicode Check" , e );
112112 return new Result ("" , false );
113113 }).thenApplyAsync (result -> {
114- if (GeneralUtils .checkAndCall (new EventBundle (player , string .get (), InfractionType .UNICODE , result , event .source ()), plugin )){
114+ if (GeneralUtils .checkAndCall (new EventBundle (player , string .get (), InfractionType .UNICODE , result , event .source ()), plugin )){
115+ if (!event .canBeModified ()) {
116+ return false ;
117+ }
115118 if (plugin .getConfig ().getUnicodeConfig ().isBlockable ()){
116119 event .cancel ();
117120 event .resume ();
118121 return true ;
119122 }
120- if (event . shouldReplace () && result instanceof final ReplaceableResult replaceable ){
123+ if (result instanceof final ReplaceableResult replaceable ){
121124 string .set (replaceable .replaceInfraction ());
122125 event .setString (string .get ());
123126 }
@@ -133,12 +136,15 @@ public static boolean caps(InfractionPlayer player, AtomicReference<String> stri
133136 return new Result ("" , false );
134137 }).thenApplyAsync (result -> {
135138 if (GeneralUtils .checkAndCall (new EventBundle (player , string .get (), InfractionType .CAPS , result , event .source ()), plugin )){
139+ if (!event .canBeModified ()) {
140+ return false ;
141+ }
136142 if (plugin .getConfig ().getCapsConfig ().isBlockable ()){
137143 event .cancel ();
138144 event .resume ();
139145 return true ;
140146 }
141- if (event . shouldReplace () && result instanceof final IReplaceable replaceable ){
147+ if (result instanceof final IReplaceable replaceable ){
142148 string .set (replaceable .replaceInfraction ());
143149 event .setString (string .get ());
144150 }
@@ -154,12 +160,15 @@ public static boolean flood(InfractionPlayer player, AtomicReference<String> str
154160 return new Result ("" , false );
155161 }).thenApplyAsync (result -> {
156162 if (GeneralUtils .checkAndCall (new EventBundle (player , string .get (), InfractionType .FLOOD , result , event .source ()), plugin )) {
163+ if (!event .canBeModified ()) {
164+ return false ;
165+ }
157166 if (plugin .getConfig ().getFloodConfig ().isBlockable ()){
158167 event .cancel ();
159168 event .resume ();
160169 return true ;
161170 }
162- if (event . shouldReplace () && result instanceof final IReplaceable replaceable ){
171+ if (result instanceof final IReplaceable replaceable ){
163172 string .set (replaceable .replaceInfraction ());
164173 event .setString (string .get ());
165174 }
@@ -175,12 +184,15 @@ public static boolean regular(InfractionPlayer player, AtomicReference<String> s
175184 return new Result ("" , false );
176185 }).thenApplyAsync (result -> {
177186 if (GeneralUtils .checkAndCall (new EventBundle (player , string .get (), InfractionType .REGULAR , result , event .source ()), plugin )) {
187+ if (!event .canBeModified ()) {
188+ return false ;
189+ }
178190 if (plugin .getConfig ().getInfractionsConfig ().isBlockable ()){
179191 event .cancel ();
180192 event .resume ();
181193 return true ;
182194 }
183- if (event . shouldReplace () && result instanceof final IReplaceable replaceable ){
195+ if (result instanceof final IReplaceable replaceable ){
184196 string .set (replaceable .replaceInfraction ());
185197 event .setString (string .get ());
186198 }
@@ -198,6 +210,9 @@ public static boolean spam(InfractionPlayer player, AtomicReference<String> stri
198210 if (GeneralUtils .cooldownSpamCheck (result , player , plugin .getConfig ())
199211 && GeneralUtils .callViolationEvent (new EventBundle (player , string .get (), InfractionType .SPAM , result , event .source ()), plugin )
200212 ) {
213+ if (!event .canBeModified ()) {
214+ return false ;
215+ }
201216 event .cancel ();
202217 event .resume ();
203218 return true ;
0 commit comments