try {
final ResultSet reader = Main.sql.selectQuery("SELECT Id, steamid FROM queue WHERE (botid = -1 || botid = " + bot.getBotId() + ") && queued = -1 ORDER BY Id LIMIT 1");
if (reader.next()) {
final int id = reader.getInt("Id");
if (Main.sql.update("UPDATE queue SET queued = '" + bot.getBotId() + "' WHERE Id = '" + id + "' and queued = -1") > 0) {
final SteamID other = new SteamID(reader.getLong("steamid"));
//do {
if (bot.steamFriends.getFriendRelationship(other) == EFriendRelationship.Friend) {
tradeQueue.add(new DbRow(id, other));
} else {
bot.steamFriends.addFriend(other);