From 2e40f295df67ec3179b9cbb4a2cbbfca5d8dd984 Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Fri, 8 May 2020 06:23:37 -0400 Subject: [PATCH] Chatlog ordered by timestamp --- .../java/com/eu/habbo/habbohotel/modtool/ModToolManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java index 8a10edbb..2a9860e3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java @@ -207,7 +207,7 @@ public class ModToolManager { public ArrayList getUserChatlog(int userId) { ArrayList chatlogs = new ArrayList<>(); - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, users.id, chatlogs_room.* FROM chatlogs_room INNER JOIN users ON users.id = chatlogs_room.user_from_id WHERE user_from_id = ? ORDER BY timestamp DESC LIMIT 150")) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, users.id, chatlogs_room.* FROM chatlogs_room INNER JOIN users ON users.id = chatlogs_room.user_from_id WHERE user_from_id = ? ORDER BY chatlogs_room.timestamp DESC LIMIT 150")) { statement.setInt(1, userId); try (ResultSet set = statement.executeQuery()) { while (set.next()) { @@ -224,7 +224,7 @@ public class ModToolManager { public ArrayList getMessengerChatlog(int userOneId, int userTwoId) { ArrayList chatLogs = new ArrayList<>(); - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, chatlogs_private.* FROM chatlogs_private INNER JOIN users ON users.id = user_from_id WHERE (user_from_id = ? AND user_to_id = ?) OR (user_from_id = ? AND user_to_id = ?) ORDER BY timestamp DESC LIMIT 50")) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, chatlogs_private.* FROM chatlogs_private INNER JOIN users ON users.id = user_from_id WHERE (user_from_id = ? AND user_to_id = ?) OR (user_from_id = ? AND user_to_id = ?) ORDER BY chatlogs_private.timestamp DESC LIMIT 50")) { statement.setInt(1, userOneId); statement.setInt(2, userTwoId); statement.setInt(3, userTwoId);