Fixed kill logging

This commit is contained in:
Robin Kupper committed 2011-06-20 22:06:19 +02:00
1 parent a87ede8f45
commit ecac31b0f4
1 file changed
+3 -3
+3 -3
View File
@@ -276,9 +276,9 @@ public class Consumer extends TimerTask
if (!kqueue.isEmpty()) { if (!kqueue.isEmpty()) {
while (!kqueue.isEmpty() && (System.currentTimeMillis() - start < config.timePerRun || count < config.forceToProcessAtLeast)) { while (!kqueue.isEmpty() && (System.currentTimeMillis() - start < config.timePerRun || count < config.forceToProcessAtLeast)) {
k = kqueue.poll(); k = kqueue.poll();
if (k == null) if (k == null || k.victim == null)
continue; continue;
if (!players.containsKey(k.killer.hashCode())) if (k.killer != null && !players.containsKey(k.killer.hashCode()))
if (!addPlayer(conn, state, k.killer)) { if (!addPlayer(conn, state, k.killer)) {
log.warning("[LogBlock Consumer] Failed to add player " + k.killer); log.warning("[LogBlock Consumer] Failed to add player " + k.killer);
continue; continue;
@@ -288,7 +288,7 @@ public class Consumer extends TimerTask
log.warning("[LogBlock Consumer] Failed to add player " + k.victim); log.warning("[LogBlock Consumer] Failed to add player " + k.victim);
continue; continue;
} }
state.execute("INSERT INTO `" + config.tables.get(k.worldHash) + "-kills` (date, killer, victim, weapon) VALUES (now(), " + players.get(k.killer.hashCode()) + ", " + k.weapon + ")"); state.execute("INSERT INTO `" + config.tables.get(k.worldHash) + "-kills` (date, killer, victim, weapon) VALUES (now(), " + (k.killer == null ? "null" : players.get(k.killer.hashCode())) + ", " + players.get(k.victim.hashCode()) + ", " + k.weapon + ")");
count++; count++;
} }
conn.commit(); conn.commit();