This commit is contained in:
len
2021-05-22 20:34:32 +02:00
parent 74fc459156
commit 4b79d6909f
22 changed files with 300 additions and 158 deletions
@@ -3,15 +3,15 @@ package com.alttd.chat.objects;
public class ChatFilter {
private final String regex;
private final ChatFilterType type;
private final FilterType type;
private String replacement = "";
public ChatFilter(String regex, ChatFilterType type) {
public ChatFilter(String regex, FilterType type) {
this.regex = regex;
this.type = type;
}
public ChatFilter(String regex, ChatFilterType type, String replacement) {
public ChatFilter(String regex, FilterType type, String replacement) {
this.regex = regex;
this.type = type;
this.replacement = replacement;
@@ -21,7 +21,7 @@ public class ChatFilter {
return regex;
}
public ChatFilterType getType() {
public FilterType getType() {
return type;
}
@@ -20,9 +20,6 @@ public class ChatUser {
private LinkedList<Mail> mails;
/**
* Not all of the objects are relevant to proxy or server, so the saving should only update if the value has been changed?
*/
public ChatUser(UUID uuid, int partyId, boolean toggled_chat, boolean force_tp, boolean toggle_Gc) {
this.uuid = uuid;
this.partyId = partyId;
@@ -37,9 +34,9 @@ public class ChatUser {
prefix = Utility.getPrefix(uuid, true);
staffPrefix = Utility.getStaffPrefix(uuid);
prefixAll = prefix + staffPrefix; //TODO test what this does cus I barely understand lp api
// a boolean is lighter then a permission check, it's what I'd suggest doing here
toggleGc = toggle_Gc;//Utility.checkPermission(uuid, "chat.gc"); //TODO put the actual permission here, I don't know what it is...
prefixAll = Utility.getPrefix(uuid, false);
toggleGc = toggle_Gc;
replyTarget = null;
mails = new LinkedList<>(); // todo load mails
}
@@ -58,7 +55,7 @@ public class ChatUser {
public void togglePartyChat() {
toggledPartyChat = !toggledPartyChat;
Queries.setPartyChatState(toggledPartyChat, uuid); //TODO: Async pls
Queries.setPartyChatState(toggledPartyChat, uuid); //TODO: Async pls - no CompleteableFuture<>!
}
public boolean ForceTp() {
@@ -67,7 +64,7 @@ public class ChatUser {
public void toggleForceTp() {
forceTp = !forceTp;
Queries.setForceTpState(forceTp, uuid); //TODO: Async pls
Queries.setForceTpState(forceTp, uuid); //TODO: Async pls - no CompleteableFuture<>!
}
public String getDisplayName() {
@@ -121,4 +118,8 @@ public class ChatUser {
public LinkedList<Mail> getMails() {
return mails;
}
public void addMail(Mail mail) {
mails.add(mail);
}
}
@@ -1,17 +1,17 @@
package com.alttd.chat.objects;
public enum ChatFilterType {
public enum FilterType {
REPLACE("replace"),
BLOCK("block");
private final String name;
ChatFilterType(String name) {
FilterType(String name) {
this.name = name;
}
public static ChatFilterType getType(String name) {
for (ChatFilterType type : ChatFilterType.values()) {
public static FilterType getType(String name) {
for (FilterType type : FilterType.values()) {
if (type.name.equalsIgnoreCase(name)) {
return type;
}