some tweaks

This commit is contained in:
destro174
2021-07-28 20:42:09 +02:00
parent ec9b474f72
commit 9674503170
9 changed files with 49 additions and 27 deletions
@@ -177,6 +177,7 @@ public final class Config {
public static List<String> REPLYCOMMANDALIASES = new ArrayList<>();
public static String MESSAGESENDER = "<hover:show_text:Click to reply><click:suggest_command:/msg <receivername> ><light_purple>(Me -> <gray><receiver></gray>)</hover> <message>";
public static String MESSAGERECIEVER = "<hover:show_text:Click to reply><click:suggest_command:/msg <sendername> ><light_purple>(<gray><sender></gray> on <server> -> Me)</hover> <message>";
public static String MESSAGESPY = "<gray>(<gray><sendername></gray> -> <receivername>) <message>";
private static void messageCommand() {
MESSAGECOMMANDALIASES.clear();
REPLYCOMMANDALIASES.clear();
@@ -184,6 +185,7 @@ public final class Config {
REPLYCOMMANDALIASES = getList("commands.reply.aliases", Lists.newArrayList("r"));
MESSAGESENDER = getString("commands.message.sender-message", MESSAGESENDER);
MESSAGERECIEVER = getString("commands.message.reciever-message", MESSAGERECIEVER);
MESSAGESPY = getString("commands.message.spy-message", MESSAGESPY);
}
public static String GCFORMAT = "<white><light_purple><prefix></light_purple> <gray><sender></gray> <hover:show_text:on <server>><yellow>to Global</yellow></hover><gray>: <message>";
@@ -68,10 +68,10 @@ public class Queries {
* returns the UUID of all players this player has ignored.
*
* @param uuid the player who ignored the other players
* @return LinkedList<UUID>
* @return List<UUID>
*/
public static LinkedList<UUID> getIgnoredUsers(UUID uuid) {
LinkedList<UUID> uuids = new LinkedList<>();
public static List<UUID> getIgnoredUsers(UUID uuid) {
List<UUID> uuids = new ArrayList<>();
String query = "SELECT * FROM ignored_users WHERE uuid = ?";
try {
@@ -387,8 +387,8 @@ public class Queries {
//-----------------------------------------
public static LinkedList<Mail> getMails(UUID uuid) {
LinkedList<Mail> mails = new LinkedList<>();
public static List<Mail> getMails(UUID uuid) {
List<Mail> mails = new ArrayList<>();
String query = "SELECT * FROM mails where uuid = ?";
try {
@@ -4,7 +4,8 @@ import com.alttd.chat.database.Queries;
import com.alttd.chat.util.Utility;
import net.kyori.adventure.text.Component;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class ChatUser {
@@ -20,9 +21,9 @@ public class ChatUser {
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
private LinkedList<Mail> mails; // mails aren't finalized yet, so for now a table sender, reciever, sendtime, readtime(if emtpy mail isn't read yet?, could also do a byte to control this), the actual message
private LinkedList<UUID> ignoredPlayers; // a list of UUID, a new table non unique, where one is is the player select * from ignores where ignoredby = thisplayer? where the result is the uuid of the player ignored by this player?
private LinkedList<UUID> ignoredBy; // a list of UUID, same table as above but select * from ignores where ignored = thisplayer? result should be the other user that ignored this player?
private List<Mail> mails; // mails aren't finalized yet, so for now a table sender, reciever, sendtime, readtime(if emtpy mail isn't read yet?, could also do a byte to control this), the actual message
private List<UUID> ignoredPlayers; // a list of UUID, a new table non unique, where one is is the player select * from ignores where ignoredby = thisplayer? where the result is the uuid of the player ignored by this player?
private List<UUID> ignoredBy; // a list of UUID, same table as above but select * from ignores where ignored = thisplayer? result should be the other user that ignored this player?
public ChatUser(UUID uuid, int partyId, boolean toggledChat, boolean toggleGc) {
this.uuid = uuid;
@@ -45,7 +46,7 @@ public class ChatUser {
gcCooldown = System.currentTimeMillis(); // players can't use gc for 30 seconds after logging in if we use this?
mails = Queries.getMails(uuid);
ignoredPlayers = Queries.getIgnoredUsers(uuid);
ignoredBy = new LinkedList<>(); // todo load ignoredPlayers
ignoredBy = new ArrayList<>(); // todo load ignoredPlayers
}
public UUID getUuid() {
@@ -104,7 +105,7 @@ public class ChatUser {
this.replyTarget = replyTarget;
}
public LinkedList<Mail> getMails() {
public List<Mail> getMails() {
return mails;
}
@@ -112,7 +113,7 @@ public class ChatUser {
mails.add(mail);
}
public LinkedList<UUID> getIgnoredPlayers() {
public List<UUID> getIgnoredPlayers() {
return ignoredPlayers;
}
@@ -124,7 +125,7 @@ public class ChatUser {
ignoredPlayers.remove(uuid);
}
public LinkedList<UUID> getIgnoredBy() {
public List<UUID> getIgnoredBy() {
return ignoredBy;
}