Don't use replacematcher for parsing text on signs

This commit is contained in:
destro174
2021-08-20 23:03:58 +02:00
parent a35ad9ebeb
commit 1d5dd7c764
9 changed files with 43 additions and 34 deletions
@@ -57,4 +57,19 @@ public class ChatFilter {
}
return input;
}
public String replaceMatcher(String input) {
int lenght;
try {
lenght = Integer.parseInt(replacement);
} catch (NumberFormatException e) {
lenght = 3; // could load this from config and make it cleaner
}
Matcher matcher = pattern.matcher(input);
while (matcher.find()) {
String group = matcher.group();
input = input.replace(group, group.substring(0, lenght));
}
return input;
}
}