move regexmanager to api
This commit is contained in:
parent
a135900a1c
commit
4124315bd7
|
|
@ -3,6 +3,7 @@ package com.alttd.chat;
|
||||||
import com.alttd.chat.config.Config;
|
import com.alttd.chat.config.Config;
|
||||||
import com.alttd.chat.database.DatabaseConnection;
|
import com.alttd.chat.database.DatabaseConnection;
|
||||||
import com.alttd.chat.managers.ChatUserManager;
|
import com.alttd.chat.managers.ChatUserManager;
|
||||||
|
import com.alttd.chat.managers.RegexManager;
|
||||||
import net.luckperms.api.LuckPerms;
|
import net.luckperms.api.LuckPerms;
|
||||||
import net.luckperms.api.LuckPermsProvider;
|
import net.luckperms.api.LuckPermsProvider;
|
||||||
import net.luckperms.api.model.group.Group;
|
import net.luckperms.api.model.group.Group;
|
||||||
|
|
@ -27,6 +28,7 @@ public class ChatImplementation implements ChatAPI{
|
||||||
databaseConnection = getDataBase();
|
databaseConnection = getDataBase();
|
||||||
|
|
||||||
ChatUserManager.initialize(); // loads all the users from the db and adds them.
|
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() {
|
public static ChatAPI get() {
|
||||||
|
|
|
||||||
|
|
@ -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.Config;
|
||||||
import com.alttd.chat.config.RegexConfig;
|
import com.alttd.chat.config.RegexConfig;
|
||||||
import com.alttd.chat.config.ServerConfig;
|
|
||||||
import com.alttd.chat.objects.RegexType;
|
import com.alttd.chat.objects.RegexType;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import ninja.leaping.configurate.ConfigurationNode;
|
import ninja.leaping.configurate.ConfigurationNode;
|
||||||
|
|
@ -13,7 +12,7 @@ import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class Regex {
|
public class RegexManager {
|
||||||
|
|
||||||
// todo move this to API!
|
// todo move this to API!
|
||||||
private static final HashMap<Pattern, ArrayList<String>> cancelRegex = new HashMap<>();
|
private static final HashMap<Pattern, ArrayList<String>> cancelRegex = new HashMap<>();
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
package com.alttd.chat.objects;
|
package com.alttd.chat.objects;
|
||||||
|
|
||||||
public class Regex {
|
public class ChatFilter {
|
||||||
|
|
||||||
private final String regex;
|
private final String regex;
|
||||||
private final RegexType type;
|
private final RegexType type;
|
||||||
private String replacement = "";
|
private String replacement = "";
|
||||||
|
|
||||||
public Regex(String regex, RegexType type) {
|
public ChatFilter(String regex, RegexType type) {
|
||||||
this.regex = regex;
|
this.regex = regex;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Regex(String regex, RegexType type, String replacement) {
|
public ChatFilter(String regex, RegexType type, String replacement) {
|
||||||
this.regex = regex;
|
this.regex = regex;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.replacement = replacement;
|
this.replacement = replacement;
|
||||||
Loading…
Reference in New Issue
Block a user