From 4c891f0819fa9fe1536e5f63ee1397bda00db0e8 Mon Sep 17 00:00:00 2001 From: Luck Date: Mon, 30 Jul 2018 11:22:50 -0700 Subject: [PATCH] Fix uppercase inconsistencies when saving users to SQL storage types (#1119) This was causing issues when user data was saved, without UUID data being saved beforehand. This commit fixes the way the inconsistency was introduced, and ensures that inconsistent data is made consistent in the future. (when players next login) --- .../me/lucko/luckperms/common/storage/dao/sql/SqlDao.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/SqlDao.java b/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/SqlDao.java index 0b9311098..df19712c4 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/SqlDao.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/SqlDao.java @@ -465,7 +465,7 @@ public class SqlDao extends AbstractDao { // insert try (PreparedStatement ps = c.prepareStatement(this.statementProcessor.apply(PLAYER_INSERT))) { ps.setString(1, user.getUuid().toString()); - ps.setString(2, user.getName().orElse("null")); + ps.setString(2, user.getName().orElse("null").toLowerCase()); ps.setString(3, user.getPrimaryGroup().getStoredValue().orElse(NodeFactory.DEFAULT_GROUP_NAME)); ps.execute(); } @@ -916,7 +916,7 @@ public class SqlDao extends AbstractDao { String oldUsername = getPlayerName(uuid); // do the insert - if (!username.equalsIgnoreCase(oldUsername)) { + if (!username.equals(oldUsername)) { try (Connection c = this.provider.getConnection()) { if (oldUsername != null) { try (PreparedStatement ps = c.prepareStatement(this.statementProcessor.apply(PLAYER_UPDATE_USERNAME_FOR_UUID))) {