Fixed being able to bypass replacement filters by having multiple of the same match in one string

This commit is contained in:
Teriuihi 2022-05-24 02:41:11 +02:00
parent dac0f7936e
commit 3e313cb00b
2 changed files with 5 additions and 1 deletions

View File

@ -76,7 +76,7 @@ public class ChatFilter {
while (matcher.find()) { while (matcher.find()) {
String group = matcher.group(); // todo debug String group = matcher.group(); // todo debug
if (getExclusions().stream().noneMatch(s -> s.equalsIgnoreCase(group))) { // idk how heavy this is:/ if (getExclusions().stream().noneMatch(s -> s.equalsIgnoreCase(group))) { // idk how heavy this is:/
modifiableString.string(input.replace(group, getReplacement())); modifiableString.replace(group, getReplacement());
} }
} }
} }

View File

@ -11,6 +11,10 @@ public class ModifiableString {
this.string = string; this.string = string;
} }
public void replace(String match, String replace) {
this.string = string.replaceAll(match, replace);
}
public String string() { public String string() {
return string; return string;
} }