Hardcoded 3 character limit for repeated characters (should be configurable)
This commit is contained in:
parent
3d5a48dabc
commit
a2aa2d8b94
|
|
@ -6,10 +6,13 @@ import com.alttd.chat.util.ALogger;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class RegexManager {
|
||||
|
||||
private static List<ChatFilter> chatFilters;
|
||||
private static final Pattern pattern = Pattern.compile("(.)\\1{4,}");
|
||||
|
||||
public static void initialize() {
|
||||
chatFilters = new ArrayList<>();
|
||||
|
|
@ -36,6 +39,13 @@ public class RegexManager {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user