diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/NicknameLastSeenPatch.java b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/NicknameLastSeenPatch.java index 4e11a247d..1755783b5 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/NicknameLastSeenPatch.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/NicknameLastSeenPatch.java @@ -21,7 +21,6 @@ import com.djrapitops.plan.system.database.databases.sql.SQLDB; import com.djrapitops.plan.system.database.databases.sql.processing.ExecStatement; import com.djrapitops.plan.system.database.databases.sql.processing.QueryAllStatement; import com.djrapitops.plan.system.database.databases.sql.tables.NicknamesTable; -import com.djrapitops.plan.system.database.databases.sql.tables.UserIDTable; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -45,6 +44,11 @@ public class NicknameLastSeenPatch extends Patch { NicknamesTable.Col.LAST_USED + " bigint NOT NULL DEFAULT '0'" ); + if (hasColumn(NicknamesTable.TABLE_NAME, NicknamesTable.Col.UUID.get())) { + // NicknamesOptimizationPatch makes this patch incompatible with newer patch versions. + return; + } + // Create table if has failed already db.executeUnsafe("CREATE TABLE IF NOT EXISTS plan_actions " + "(action_id integer, date bigint, server_id integer, user_id integer, additional_info varchar(1))"); @@ -70,7 +74,7 @@ public class NicknameLastSeenPatch extends Patch { while (set.next()) { long date = set.getLong("date"); - int userID = set.getInt(UserIDTable.Col.USER_ID.get()); + int userID = set.getInt("user_id"); int serverID = set.getInt("server_id"); UUID serverUUID = serverUUIDsByID.get(serverID); Nickname nick = new Nickname(set.getString("additional_info"), date, serverUUID); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/GeoInfoTable.java b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/GeoInfoTable.java index d382a0bb5..ff5f8933c 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/GeoInfoTable.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/GeoInfoTable.java @@ -243,8 +243,6 @@ public class GeoInfoTable extends UserUUIDTable { public enum Col implements Column { ID("id"), - @Deprecated - USER_ID(UserIDTable.Col.USER_ID.get()), UUID(UserUUIDTable.Col.UUID.get()), IP("ip"), IP_HASH("ip_hash"), diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/KillsTable.java b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/KillsTable.java index da2d8cee3..9c6284ce1 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/KillsTable.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/KillsTable.java @@ -324,14 +324,8 @@ public class KillsTable extends UserUUIDTable { public enum Col implements Column { ID("id"), - @Deprecated - KILLER_ID("killer_id"), KILLER_UUID("killer_uuid"), - @Deprecated - VICTIM_ID("victim_id"), VICTIM_UUID("victim_uuid"), - @Deprecated - SERVER_ID("server_id"), SERVER_UUID("server_uuid"), SESSION_ID("session_id"), WEAPON("weapon"), diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/NicknamesTable.java b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/NicknamesTable.java index 2224c1d11..88a8662f9 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/NicknamesTable.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/NicknamesTable.java @@ -275,11 +275,7 @@ public class NicknamesTable extends UserUUIDTable { public enum Col implements Column { ID("id"), - @Deprecated - USER_ID(UserIDTable.Col.USER_ID.get()), UUID(UserUUIDTable.Col.UUID.get()), - @Deprecated - SERVER_ID("server_id"), SERVER_UUID("server_uuid"), NICKNAME("nickname"), LAST_USED("last_used"); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/PingTable.java b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/PingTable.java index d39f2c5cc..8f7153158 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/PingTable.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/PingTable.java @@ -193,11 +193,7 @@ public class PingTable extends UserUUIDTable { public enum Col implements Column { ID("id"), - @Deprecated - USER_ID(UserIDTable.Col.USER_ID.get()), UUID(UserUUIDTable.Col.UUID.get()), - @Deprecated - SERVER_ID("server_id"), SERVER_UUID("server_uuid"), DATE("date"), MAX_PING("max_ping"), diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/SessionsTable.java b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/SessionsTable.java index cdbbce728..22052a430 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/SessionsTable.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/SessionsTable.java @@ -598,12 +598,8 @@ public class SessionsTable extends UserUUIDTable { } public enum Col implements Column { - @Deprecated - USER_ID(UserIDTable.Col.USER_ID.get()), UUID(UserUUIDTable.Col.UUID.get()), ID("id"), - @Deprecated - SERVER_ID("server_id"), SERVER_UUID("server_uuid"), SESSION_START("session_start"), SESSION_END("session_end"), diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UserIDTable.java b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UserIDTable.java deleted file mode 100644 index 39eeae531..000000000 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UserIDTable.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This file is part of Player Analytics (Plan). - * - * Plan is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License v3 as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Plan is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Plan. If not, see . - */ -package com.djrapitops.plan.system.database.databases.sql.tables; - -import com.djrapitops.plan.system.database.databases.sql.SQLDB; -import com.djrapitops.plan.system.database.databases.sql.processing.ExecStatement; -import com.djrapitops.plan.system.database.databases.sql.statements.Column; - -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.UUID; - -/** - * Represents a Table that uses UsersTable IDs to get their data. - * - * @author Rsl1122 - * @since 3.7.0 - */ -@Deprecated -public abstract class UserIDTable extends Table { - - public enum Col implements Column { - USER_ID("user_id"); - - private final String column; - - Col(String column) { - this.column = column; - } - - @Override - public String get() { - return toString(); - } - - @Override - public String toString() { - return column; - } - } - - protected final UsersTable usersTable; - - public UserIDTable(String name, SQLDB db) { - super(name, db); - usersTable = db.getUsersTable(); - } - - public void removeUser(UUID uuid) { - String sql = "DELETE FROM " + tableName + " WHERE (" + Col.USER_ID + "=" + usersTable.statementSelectID + ")"; - - execute(new ExecStatement(sql) { - @Override - public void prepare(PreparedStatement statement) throws SQLException { - statement.setString(1, uuid.toString()); - } - }); - } -} diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UserInfoTable.java b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UserInfoTable.java index df5392e51..e248b99a1 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UserInfoTable.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UserInfoTable.java @@ -362,11 +362,7 @@ public class UserInfoTable extends UserUUIDTable { public enum Col implements Column { ID("id"), - @Deprecated - USER_ID(UserIDTable.Col.USER_ID.get()), UUID(UserUUIDTable.Col.UUID.get()), - @Deprecated - SERVER_ID("server_id"), SERVER_UUID("server_uuid"), REGISTERED("registered"), OP("opped"), diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UsersTable.java b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UsersTable.java index 7b980e814..9d5eb0a75 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UsersTable.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UsersTable.java @@ -380,26 +380,6 @@ public class UsersTable extends UserUUIDTable { }); } - @Deprecated - public Map getUUIDsByID() { - String sql = Select.from(tableName, Col.ID, Col.UUID).toString(); - - return query(new QueryAllStatement>(sql, 20000) { - @Override - public Map processResults(ResultSet set) throws SQLException { - Map uuidsByID = new TreeMap<>(); - - while (set.next()) { - int id = set.getInt(Col.ID.get()); - UUID uuid = UUID.fromString(set.getString(Col.UUID.get())); - uuidsByID.put(id, uuid); - } - - return uuidsByID; - } - }); - } - /** * Gets the {@code UUID} and the name of the player mapped to the user ID * diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTable.java b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTable.java index e79e7e640..2b8712d63 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTable.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTable.java @@ -178,8 +178,6 @@ public class WorldTable extends Table { public enum Col implements Column { ID("id"), - @Deprecated - SERVER_ID("server_id"), SERVER_UUID("server_uuid"), NAME("world_name"); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java index 2fa2556fc..ef3e3bb59 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java @@ -386,11 +386,7 @@ public class WorldTimesTable extends UserUUIDTable { public enum Col implements Column { ID("id"), - @Deprecated - USER_ID(UserIDTable.Col.USER_ID.get()), UUID(UserUUIDTable.Col.UUID.get()), - @Deprecated - SERVER_ID("server_id"), SERVER_UUID("server_uuid"), SESSION_ID("session_id"), WORLD_ID("world_id"),