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
@@ -30,6 +30,10 @@ public class RegexManager {
}
public static String replaceText(String playerName, UUID uuid, String text) { // TODO loop all objects in the list and check if they violate based on the MATCHER
return replaceText(playerName, uuid, text, true);
}
public static String replaceText(String playerName, UUID uuid, String text, boolean matcher) {
User user = ChatAPI.get().getLuckPerms().getUserManager().getUser(uuid);
if (user == null) {
ALogger.warn("Tried to check chat filters for a user who doesn't exist in LuckPerms");
@@ -49,15 +53,13 @@ public class RegexManager {
return null;
}
break;
case REPLACEMATCHER:
if(matcher) {
text = chatFilter.replaceMatcher(text);
}
break;
}
}
Matcher matcher = pattern.matcher(text);
while (matcher.find()) {
String group = matcher.group();
System.out.println(group);
text = text.replace(group, group.substring(0, 3)); //TODO HARD CODED PLS PUT IN CONFIG
System.out.println(text);
}
return text;
}