From 278602db36e8f574e7fe71474a7a3cf1dfb2351d Mon Sep 17 00:00:00 2001 From: Risto Lahtela <24460436+Rsl1122@users.noreply.github.com> Date: Sat, 28 Mar 2020 10:28:13 +0200 Subject: [PATCH] Made Server identifier query more flexible Affects issues: - Possibly fixed #1381 --- .../plan/storage/database/queries/objects/ServerQueries.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/objects/ServerQueries.java b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/objects/ServerQueries.java index 1042aaba0..ec79ad908 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/objects/ServerQueries.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/objects/ServerQueries.java @@ -85,6 +85,7 @@ public class ServerQueries { String sql = SELECT + '*' + FROM + ServerTable.TABLE_NAME + " WHERE (LOWER(" + ServerTable.SERVER_UUID + ") LIKE LOWER(?)" + OR + "LOWER(" + ServerTable.NAME + ") LIKE LOWER(?)" + + OR + ServerTable.SERVER_ID + "=?" + OR + ServerTable.SERVER_ID + "=?)" + AND + ServerTable.INSTALLED + "=?" + " LIMIT 1"; @@ -94,7 +95,9 @@ public class ServerQueries { statement.setString(1, identifier); statement.setString(2, identifier); statement.setInt(3, NumberUtils.isParsable(identifier) ? Integer.parseInt(identifier) : -1); - statement.setBoolean(4, true); + String id = identifier.startsWith("Server ") ? identifier.substring(7) : identifier; + statement.setInt(4, NumberUtils.isParsable(id) ? Integer.parseInt(id) : -1); + statement.setBoolean(5, true); } @Override