Skip to content

Commit

Permalink
Update the player's namer in the database on join, in case it changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Brianetta committed May 26, 2019
1 parent a9c182c commit e74131b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/net/simplycrafted/StickyLocks/Database.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit e74131b

Please sign in to comment.