From e74131bedd93883bef20499e04837e0fa5cfbcd3 Mon Sep 17 00:00:00 2001 From: Brian Ronald Date: Sun, 26 May 2019 01:47:46 +0100 Subject: [PATCH] Update the player's namer in the database on join, in case it changed --- src/main/java/net/simplycrafted/StickyLocks/Database.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/net/simplycrafted/StickyLocks/Database.java b/src/main/java/net/simplycrafted/StickyLocks/Database.java index 9b4e73a..41eb0f1 100644 --- a/src/main/java/net/simplycrafted/StickyLocks/Database.java +++ b/src/main/java/net/simplycrafted/StickyLocks/Database.java @@ -299,6 +299,11 @@ public void addPlayer(Player player) { psql.setString(2, player.getName()); psql.setString(3, player.getUniqueId().toString()); psql.executeUpdate(); + // Update the name, in case the previous sub-select returned 1 + psql = db_conn.prepareStatement("UPDATE player SET name=? WHERE uuid=?"); + psql.setString(1, player.getName()); + psql.setString(2, player.getUniqueId().toString()); + psql.executeUpdate(); psql.close(); } catch (SQLException e) { stickylocks.getLogger().info("Failed to insert/replace newly joined player");