Refactor RegexObject to ChatFilter and ChatFilterType
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user