move regexmanager to api

This commit is contained in:
len 2021-05-20 18:45:26 +02:00
parent a135900a1c
commit 4124315bd7
3 changed files with 7 additions and 6 deletions

View File

@ -3,6 +3,7 @@ package com.alttd.chat;
import com.alttd.chat.config.Config;
import com.alttd.chat.database.DatabaseConnection;
import com.alttd.chat.managers.ChatUserManager;
import com.alttd.chat.managers.RegexManager;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;
import net.luckperms.api.model.group.Group;
@ -27,6 +28,7 @@ public class ChatImplementation implements ChatAPI{
databaseConnection = getDataBase();
ChatUserManager.initialize(); // loads all the users from the db and adds them.
RegexManager.initRegex(); // load the filters and regexes from config
}
public static ChatAPI get() {

View File

@ -1,8 +1,7 @@
package com.alttd.chat.util;
package com.alttd.chat.managers;
import com.alttd.chat.config.Config;
import com.alttd.chat.config.RegexConfig;
import com.alttd.chat.config.ServerConfig;
import com.alttd.chat.objects.RegexType;
import com.google.common.collect.Lists;
import ninja.leaping.configurate.ConfigurationNode;
@ -13,7 +12,7 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Regex {
public class RegexManager {
// todo move this to API!
private static final HashMap<Pattern, ArrayList<String>> cancelRegex = new HashMap<>();

View File

@ -1,17 +1,17 @@
package com.alttd.chat.objects;
public class Regex {
public class ChatFilter {
private final String regex;
private final RegexType type;
private String replacement = "";
public Regex(String regex, RegexType type) {
public ChatFilter(String regex, RegexType type) {
this.regex = regex;
this.type = type;
}
public Regex(String regex, RegexType type, String replacement) {
public ChatFilter(String regex, RegexType type, String replacement) {
this.regex = regex;
this.type = type;
this.replacement = replacement;