Chat/api/src/main/java/com/alttd/chat/objects/ChatUser.java

126 lines
2.8 KiB
Java
Raw Normal View History

2021-05-14 00:33:23 +00:00
package com.alttd.chat.objects;
import com.alttd.chat.database.Queries;
import com.alttd.chat.util.Utility;
2021-05-14 00:33:23 +00:00
2021-05-15 22:28:47 +00:00
import java.util.LinkedList;
2021-05-14 00:33:23 +00:00
import java.util.UUID;
public class ChatUser {
private final UUID uuid;
private final int partyId;
2021-05-16 00:02:03 +00:00
private boolean toggledPartyChat;
2021-05-14 00:33:23 +00:00
private boolean forceTp;
private String displayName;
private String prefix;
private String staffPrefix;
private String prefixAll;
private boolean toggleGc;
2021-05-15 22:28:47 +00:00
private UUID replyTarget;
2021-05-14 00:33:23 +00:00
2021-05-15 22:28:47 +00:00
private LinkedList<Mail> mails;
2021-05-15 10:34:19 +00:00
public ChatUser(UUID uuid, int partyId, boolean toggled_chat, boolean force_tp, boolean toggle_Gc) {
2021-05-14 00:33:23 +00:00
this.uuid = uuid;
this.partyId = partyId;
2021-05-16 00:02:03 +00:00
this.toggledPartyChat = toggled_chat;
2021-05-14 00:33:23 +00:00
this.forceTp = force_tp;
displayName = Queries.getNickname(uuid);
if (displayName == null) {
displayName = Utility.getDisplayName(uuid);
2021-05-14 00:33:23 +00:00
}
prefix = Utility.getPrefix(uuid, true);
staffPrefix = Utility.getStaffPrefix(uuid);
2021-05-22 18:34:32 +00:00
prefixAll = Utility.getPrefix(uuid, false);
toggleGc = toggle_Gc;
2021-05-15 22:28:47 +00:00
replyTarget = null;
mails = new LinkedList<>(); // todo load mails
2021-05-14 00:33:23 +00:00
}
public UUID getUuid() {
return uuid;
}
public int getPartyId() {
return partyId;
}
2021-05-16 00:02:03 +00:00
public boolean toggledPartyChat() {
return toggledPartyChat;
2021-05-14 00:33:23 +00:00
}
2021-05-16 00:02:03 +00:00
public void togglePartyChat() {
toggledPartyChat = !toggledPartyChat;
2021-05-22 18:34:32 +00:00
Queries.setPartyChatState(toggledPartyChat, uuid); //TODO: Async pls - no CompleteableFuture<>!
2021-05-14 00:33:23 +00:00
}
public boolean ForceTp() {
return forceTp;
}
public void toggleForceTp() {
forceTp = !forceTp;
2021-05-22 18:34:32 +00:00
Queries.setForceTpState(forceTp, uuid); //TODO: Async pls - no CompleteableFuture<>!
2021-05-14 00:33:23 +00:00
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public String getStaffPrefix() {
return staffPrefix;
}
public void setStaffPrefix(String staffPrefix) {
this.staffPrefix = staffPrefix;
}
public String getPrefixAll() {
return prefixAll;
}
public void setPrefixAll(String prefixAll) {
this.prefixAll = prefixAll;
}
public void toggleGc() {
toggleGc = !toggleGc;
}
public boolean isGcOn() {
return toggleGc;
}
2021-05-15 19:16:01 +00:00
2021-05-15 22:28:47 +00:00
public UUID getReplyTarget() {
return replyTarget;
}
public void setReplyTarget(UUID replyTarget) {
this.replyTarget = replyTarget;
2021-05-15 19:16:01 +00:00
}
2021-05-15 22:28:47 +00:00
public LinkedList<Mail> getMails() {
return mails;
2021-05-15 19:16:01 +00:00
}
2021-05-22 18:34:32 +00:00
public void addMail(Mail mail) {
mails.add(mail);
}
2021-05-14 00:33:23 +00:00
}