auto commit

This commit is contained in:
destro174
2021-07-27 18:46:58 +02:00
parent 04ac327365
commit 0891e252f9
25 changed files with 362 additions and 70 deletions
@@ -13,9 +13,9 @@ public class ChatUser {
private boolean toggledPartyChat; // should chat messages instantly go to party chat when added, idk if this should be saved
private String name; // the nickname, doesn't need to be saved with the chatuser object, could be saved but we can get it from the nicknamesview
private Component displayName; // the nickname, doesn't need to be saved with the chatuser object, could be saved but we can get it from the nicknamesview
private Component prefix; // doesn't need saving, we get this from luckperms
private Component staffPrefix; // doesn't need saving, we get this from luckperms
private Component prefixAll; // doesn't need saving, we get this from luckperms
// private Component prefix; // doesn't need saving, we get this from luckperms
// private Component staffPrefix; // doesn't need saving, we get this from luckperms
// private Component prefixAll; // doesn't need saving, we get this from luckperms
private boolean toggleGc; // should be saved, this toggles if the player can see and use global chat
private String replyTarget; // reply target for use in /msg i don't mind setting this to null on login, feedback?
private long gcCooldown; // the time when they last used gc, is used for the cooldown, i wouldn't save this, but setting this to the login time means they can't use gc for 30 seconds after logging in
@@ -35,15 +35,15 @@ public class ChatUser {
}
setDisplayName(name);
prefix = Utility.getPrefix(uuid, true);
staffPrefix = Utility.getStaffPrefix(uuid);
prefixAll = Utility.getPrefix(uuid, false);
// prefix = Utility.getPrefix(uuid, true); // TODO we need to update this, so cache and update when needed or always request it?
// staffPrefix = Utility.getStaffPrefix(uuid);
//
// prefixAll = Utility.getPrefix(uuid, false);
this.toggleGc = toggleGc;
replyTarget = null;
gcCooldown = System.currentTimeMillis(); // players can't use gc for 30 seconds after logging in if we use this?
mails = new LinkedList<>(); // todo load mails
mails = Queries.getMails(uuid);
ignoredPlayers = Queries.getIgnoredUsers(uuid);
ignoredBy = new LinkedList<>(); // todo load ignoredPlayers
}
@@ -74,15 +74,18 @@ public class ChatUser {
}
public Component getPrefix() {
return prefix;
//return prefix;
return Utility.getPrefix(uuid, true); // No longer cache this data
}
public Component getStaffPrefix() {
return staffPrefix;
//return staffPrefix;
return Utility.getStaffPrefix(uuid);
}
public Component getPrefixAll() {
return prefixAll;
//return prefixAll;
return Utility.getPrefix(uuid, false);
}
public void toggleGc() {
@@ -117,6 +120,10 @@ public class ChatUser {
ignoredPlayers.add(uuid);
}
public void removeIgnoredPlayers(UUID uuid) {
ignoredPlayers.remove(uuid);
}
public LinkedList<UUID> getIgnoredBy() {
return ignoredBy;
}
@@ -6,20 +6,26 @@ public class Mail {
private final UUID uuid; // the player
private final UUID sender; // the sender
private boolean read;
private final long sendTime; // any other option for this? does the db store recordcreation and edit time?
private long readTime; // any other option for this?
private final String message; // do we want staff to edit this after being send but being unread?
public Mail(UUID player, UUID sender, Boolean read, long sendTime, long readTime, String message) {
public Mail(UUID player, UUID sender, long sendTime, long readTime, String message) {
this.uuid = player;
this.sender = sender;
this.read = read;
this.sendTime = sendTime;
this.readTime = readTime;
this.message = message;
}
public Mail(UUID player, UUID sender, String message) {
this.uuid = player;
this.sender = sender;
this.sendTime = System.nanoTime();
this.readTime = System.nanoTime();
this.message = message;
}
public UUID getUuid() {
return uuid;
}
@@ -29,11 +35,7 @@ public class Mail {
}
public boolean isUnRead() {
return read;
}
public void setRead(boolean read) {
this.read = read;
return getSendTime() != getReadTime();
}
public long getSendTime() {