Refactor RegexObject to ChatFilter and ChatFilterType

This commit is contained in:
len
2021-05-20 18:47:22 +02:00
parent 4124315bd7
commit 8fc9e0c447
3 changed files with 11 additions and 12 deletions
@@ -3,15 +3,15 @@ package com.alttd.chat.objects;
public class ChatFilter {
private final String regex;
private final RegexType type;
private final ChatFilterType type;
private String replacement = "";
public ChatFilter(String regex, RegexType type) {
public ChatFilter(String regex, ChatFilterType type) {
this.regex = regex;
this.type = type;
}
public ChatFilter(String regex, RegexType type, String replacement) {
public ChatFilter(String regex, ChatFilterType type, String replacement) {
this.regex = regex;
this.type = type;
this.replacement = replacement;
@@ -21,7 +21,7 @@ public class ChatFilter {
return regex;
}
public RegexType getType() {
public ChatFilterType getType() {
return type;
}
@@ -1,17 +1,17 @@
package com.alttd.chat.objects;
public enum RegexType {
public enum ChatFilterType {
REPLACE("replace"),
BLOCK("block");
private final String name;
RegexType(String name) {
ChatFilterType(String name) {
this.name = name;
}
public static RegexType getType(String name) {
for (RegexType type : RegexType.values()) {
public static ChatFilterType getType(String name) {
for (ChatFilterType type : ChatFilterType.values()) {
if (type.name.equalsIgnoreCase(name)) {
return type;
}