diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 10a4e950e..52fbec31e 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -588,6 +588,18 @@ public class AdminCommand implements CommandExecutor { } catch (Exception e) { sender.sendMessage("An error occured while trying to get that player!"); } + } else if (args[0].equalsIgnoreCase("resetname")) { + Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() { + + @Override + public void run() { + List auths = plugin.database.getAllAuths(); + for (PlayerAuth auth : auths) { + auth.setRealName("Player"); + plugin.database.updateSession(auth); + } + } + }); } else { sender.sendMessage("Usage: /authme reload|register playername password|changepassword playername password|unregister playername"); } diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index fb96bc7cb..3d1aa5cc2 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -70,6 +70,7 @@ public class CacheDataSource implements DataSource { if (cache.containsKey(auth.getNickname())) { cache.get(auth.getNickname()).setIp(auth.getIp()); cache.get(auth.getNickname()).setLastLogin(auth.getLastLogin()); + cache.get(auth.getNickname()).setRealName(auth.getRealName()); } return true; } diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 135d544fa..9509192d8 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -517,10 +517,11 @@ public class MySQL implements DataSource { PreparedStatement pst = null; try { con = makeSureConnectionIsReady(); - pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnIp + "=?, " + columnLastLogin + "=? WHERE LOWER(" + columnName + ")=?;"); + pst = con.prepareStatement("UPDATE " + tableName + " SET " + columnIp + "=?, " + columnLastLogin + "=?, " + columnRealName + "=? WHERE LOWER(" + columnName + ")=?;"); pst.setString(1, auth.getIp()); pst.setLong(2, auth.getLastLogin()); - pst.setString(3, auth.getNickname()); + pst.setString(3, auth.getRealName()); + pst.setString(4, auth.getNickname()); pst.executeUpdate(); } catch (SQLException ex) { ConsoleLogger.showError(ex.getMessage());