JDCConnection conn = getConnection();
PreparedStatement stmnt = null;
try {
while (!queue.isEmpty()) {
DataEntry entry = queue.poll();
//Sort out player IDs
if (!dbPlayers.containsKey(entry.getPlayer()) && !addPlayer(entry.getPlayer())) {
Util.debug("Player '" + entry.getPlayer() + "' not found, skipping entry");
continue;
}
if (!dbWorlds.containsKey(entry.getWorld()) && !addWorld(entry.getWorld())) {
Util.debug("World '" + entry.getWorld() + "' not found, skipping entry");
continue;
}
//If player ID is unable to be found, continue
if (entry.getPlayer() == null || dbPlayers.get(entry.getPlayer()) == null) {
Util.debug("No player found, skipping entry");
continue;
}
//If we are re-inserting we need to also insert the data ID
if (entry.getDataId() > 0) {
stmnt = conn.prepareStatement("INSERT into `" + Config.DbHawkEyeTable + "` (date, player_id, action, world_id, x, y, z, data, plugin, data_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
stmnt.setInt(10, entry.getDataId());
}
else
stmnt = conn.prepareStatement("INSERT into `" + Config.DbHawkEyeTable + "` (date, player_id, action, world_id, x, y, z, data, plugin) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);");
stmnt.setString(1, entry.getDate());
stmnt.setInt(2, dbPlayers.get(entry.getPlayer()));
stmnt.setInt(3, entry.getType().getId());
stmnt.setInt(4, dbWorlds.get(entry.getWorld()));
stmnt.setDouble(5, entry.getX());
stmnt.setDouble(6, entry.getY());
stmnt.setDouble(7, entry.getZ());
stmnt.setString(8, entry.getSqlData());
stmnt.setString(9, entry.getPlugin());
stmnt.executeUpdate();
stmnt.close();
}
conn.close();
} catch (Exception ex) {