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)
This commit is contained in:
Luck 2018-07-30 11:22:50 -07:00
parent 4b3d11ccab
commit 4c891f0819
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -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))) {