diff --git a/.gitignore b/.gitignore index 736dc24..d43ff47 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /.project /.settings /bin -/release \ No newline at end of file +/release +/agitar \ No newline at end of file diff --git a/src/de/diddiz/LogBlock/Consumer.java b/src/de/diddiz/LogBlock/Consumer.java index 0e4cea0..e7d1580 100644 --- a/src/de/diddiz/LogBlock/Consumer.java +++ b/src/de/diddiz/LogBlock/Consumer.java @@ -39,7 +39,7 @@ public class Consumer extends TimerTask private final Set hiddenPlayers, hiddenBlocks; private final Set failedPlayers = new HashSet(); private final LogBlock logblock; - private final Map players = new HashMap(); + private final Map playerIds = new HashMap(); private final Lock lock = new ReentrantLock(); Consumer(LogBlock logblock) { @@ -263,7 +263,7 @@ public class Consumer extends TimerTask if (r == null) continue; for (final String player : r.getPlayers()) - if (!players.containsKey(player.hashCode())) + if (!playerIds.containsKey(player)) if (!addPlayer(state, player)) { if (!failedPlayers.contains(player)) { failedPlayers.add(player); @@ -298,7 +298,7 @@ public class Consumer extends TimerTask public void writeToFile() throws FileNotFoundException { final long time = System.currentTimeMillis(); - final Set insertedPlayers = new HashSet(); + final Set insertedPlayers = new HashSet(); int counter = 0; new File("plugins/LogBlock/import/").mkdirs(); PrintWriter writer = new PrintWriter(new File("plugins/LogBlock/import/queue-" + time + "-0.sql")); @@ -307,9 +307,9 @@ public class Consumer extends TimerTask if (r == null) continue; for (final String player : r.getPlayers()) - if (!players.containsKey(player.hashCode()) && !insertedPlayers.contains(player.hashCode())) { + if (!playerIds.containsKey(player) && !insertedPlayers.contains(player)) { writer.println("INSERT IGNORE INTO `lb-players` (playername) VALUES ('" + player + "');"); - insertedPlayers.add(player.hashCode()); + insertedPlayers.add(player); } for (final String insert : r.getInserts()) writer.println(insert); @@ -340,9 +340,9 @@ public class Consumer extends TimerTask state.execute("INSERT IGNORE INTO `lb-players` (playername) VALUES ('" + playerName + "')"); final ResultSet rs = state.executeQuery("SELECT playerid FROM `lb-players` WHERE playername = '" + playerName + "'"); if (rs.next()) - players.put(playerName.hashCode(), rs.getInt(1)); + playerIds.put(playerName, rs.getInt(1)); rs.close(); - return players.containsKey(playerName.hashCode()); + return playerIds.containsKey(playerName); } private void queueBlock(String playerName, Location loc, int typeBefore, int typeAfter, byte data, String signtext, ChestAccess ca) { @@ -357,7 +357,7 @@ public class Consumer extends TimerTask private String playerID(String playerName) { if (playerName == null) return "NULL"; - final Integer id = players.get(playerName.hashCode()); + final Integer id = playerIds.get(playerName); if (id != null) return id.toString(); return "(SELECT playerid FROM `lb-players` WHERE playername = '" + playerName + "')";