diff --git a/api/src/main/java/com/alttd/chat/database/Queries.java b/api/src/main/java/com/alttd/chat/database/Queries.java index 7fb790b..7185bad 100644 --- a/api/src/main/java/com/alttd/chat/database/Queries.java +++ b/api/src/main/java/com/alttd/chat/database/Queries.java @@ -22,7 +22,7 @@ public class Queries { List tables = new ArrayList<>(); tables.add("CREATE TABLE IF NOT EXISTS ignored_users (`uuid` VARCHAR(36) NOT NULL, `ignored_uuid` VARCHAR(36) NOT NULL, PRIMARY KEY (`uuid`, `ignored_uuid`))"); tables.add("CREATE TABLE IF NOT EXISTS parties (`id` INT NOT NULL AUTO_INCREMENT, `owner_uuid` VARCHAR(36) NOT NULL, `party_name` VARCHAR(36) NOT NULL, `password` VARCHAR(36), PRIMARY KEY (`id`))"); - tables.add("CREATE TABLE IF NOT EXISTS chat_users (`uuid` VARCHAR(36) NOT NULL, `party_id` INT NOT NULL, `toggled_chat` BIT(1) DEFAULT b'0', `force_tp` BIT(1) DEFAULT b'1', `toggled_gc` BIT(1) DEFAULT b'0', PRIMARY KEY (`uuid`))"); + tables.add("CREATE TABLE IF NOT EXISTS chat_users (`uuid` VARCHAR(36) NOT NULL, `party_id` INT NOT NULL, `toggled_chat` BIT(1) DEFAULT b'0', `toggled_gc` BIT(1) DEFAULT b'0', PRIMARY KEY (`uuid`))"); try { Connection connection = DatabaseConnection.getConnection(); @@ -262,7 +262,6 @@ public class Queries { UUID uuid = UUID.fromString(resultSet.getString("uuid")); int partyId = resultSet.getInt("party_id"); boolean toggled_chat = resultSet.getInt("toggled_chat") == 1; - boolean force_tp = resultSet.getInt("force_tp") == 1; boolean toggle_Gc = resultSet.getInt("toggled_gc") == 1; if (partyId == 0) { @@ -278,7 +277,7 @@ public class Queries { continue; } - party.addUser(new ChatUser(uuid, partyId, toggled_chat, force_tp, toggle_Gc)); + party.addUser(new ChatUser(uuid, partyId, toggled_chat, toggle_Gc)); } } catch (SQLException e) { @@ -299,10 +298,9 @@ public class Queries { UUID uuid = UUID.fromString(resultSet.getString("uuid")); int partyId = resultSet.getInt("party_id"); boolean toggled_chat = resultSet.getInt("toggled_chat") == 1; - boolean force_tp = resultSet.getInt("force_tp") == 1; boolean toggle_Gc = resultSet.getInt("toggled_gc") == 1; // could do a constructor for chatuser to accept the record? - ChatUserManager.addUser(new ChatUser(uuid, partyId, toggled_chat, force_tp, toggle_Gc)); + ChatUserManager.addUser(new ChatUser(uuid, partyId, toggled_chat, toggle_Gc)); } } catch (SQLException e) { @@ -311,7 +309,7 @@ public class Queries { } public static void addUser(ChatUser user) { - String query = "INSERT INTO chat_users (uuid, party_id, toggled_chat, force_tp, toggled_gc) VALUES (?, ?, ?, ?, ?)"; + String query = "INSERT INTO chat_users (uuid, party_id, toggled_chat, toggled_gc) VALUES (?, ?, ?, ?)"; try { Connection connection = DatabaseConnection.getConnection(); @@ -320,7 +318,6 @@ public class Queries { statement.setString(1, user.getUuid().toString()); statement.setInt(2, user.getPartyId()); statement.setInt(3, user.toggledPartyChat() ? 1 : 0); - statement.setInt(4, user.ForceTp() ? 1 : 0); statement.setInt(5, user.isGcOn() ? 1 : 0); statement.execute(); @@ -333,10 +330,6 @@ public class Queries { setBitWhereId("UPDATE chat_users set toggled_chat = ? WHERE uuid = ?", toggledChat, uuid); } - public static void setForceTpState(boolean forceTp, UUID uuid) { - setBitWhereId("UPDATE chat_users set force_tp = ? WHERE uuid = ?", forceTp, uuid); - } - private static void setBitWhereId(String query, boolean bool, UUID uuid) { try { Connection connection = DatabaseConnection.getConnection(); diff --git a/api/src/main/java/com/alttd/chat/objects/ChatUser.java b/api/src/main/java/com/alttd/chat/objects/ChatUser.java index 8cc3e26..861a9b3 100644 --- a/api/src/main/java/com/alttd/chat/objects/ChatUser.java +++ b/api/src/main/java/com/alttd/chat/objects/ChatUser.java @@ -10,7 +10,6 @@ public class ChatUser { private final UUID uuid; // player uuid private final int partyId; // the party they are in private boolean toggledPartyChat; // should chat messages instantly go to party chat when added, idk if this should be saved - private boolean forceTp; // idk ask teri private String 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 String prefix; // doesn't need saving, we get this from luckperms private String staffPrefix; // doesn't need saving, we get this from luckperms @@ -23,11 +22,10 @@ public class ChatUser { private LinkedList 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 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 toggled_chat, boolean force_tp, boolean toggle_Gc) { + public ChatUser(UUID uuid, int partyId, boolean toggledChat, boolean toggleGc) { this.uuid = uuid; this.partyId = partyId; - this.toggledPartyChat = toggled_chat; - this.forceTp = force_tp; + this.toggledPartyChat = toggledChat; displayName = Queries.getNickname(uuid); if (displayName == null) { @@ -39,7 +37,7 @@ public class ChatUser { prefixAll = Utility.getPrefix(uuid, false); - toggleGc = toggle_Gc; + 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 @@ -64,15 +62,6 @@ public class ChatUser { Queries.setPartyChatState(toggledPartyChat, uuid); //TODO: Async pls - no CompleteableFuture<>! } - public boolean ForceTp() { - return forceTp; - } - - public void toggleForceTp() { - forceTp = !forceTp; - Queries.setForceTpState(forceTp, uuid); //TODO: Async pls - no CompleteableFuture<>! - } - public String getDisplayName() { return displayName; }