Fixed "Failed to add player" issue when the player name has different

case letters than the one in the database
This commit is contained in:
Robin Kupper
2011-06-13 12:19:47 +02:00
parent d0c60e47c4
commit 2f54baee0c

View File

@@ -321,8 +321,13 @@ public class Consumer extends TimerTask
state.execute("INSERT IGNORE INTO `lb-players` (playername) VALUES ('" + playerName + "')");
conn.commit();
final ResultSet rs = state.executeQuery("SELECT playername FROM `lb-players`");
while (rs.next())
players.add(rs.getString(1).hashCode());
while (rs.next()) {
final String name = rs.getString(1);
if (name.equalsIgnoreCase(playerName))
players.add(playerName.hashCode());
else
players.add(name.hashCode());
}
rs.close();
return players.contains(playerName.hashCode());
}