Added ping logging to Antihack reports.

This commit is contained in:
Jonathan Williams 2014-04-28 01:53:02 -07:00
parent fd372b8418
commit 1bcdc71c14

View File

@ -5,6 +5,7 @@ import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
public class AntiHackRepository
@ -16,8 +17,8 @@ public class AntiHackRepository
private String _userName = "root";
private String _password = "tAbechAk3wR7tuTh";
private static String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS AntiHack_Log (id INT NOT NULL AUTO_INCREMENT, updated LONG, playerName VARCHAR(256), motd VARCHAR(56), gameType VARCHAR(56), map VARCHAR(256), serverName VARCHAR(256), report VARCHAR(256), PRIMARY KEY (id));";
private static String UPDATE_PLAYER_OFFENSES = "INSERT INTO AntiHack_Log (updated, playerName, motd, gameType, map, serverName, report) VALUES (now(), ?, ?, ?, ?, ?, ?);";
private static String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS AntiHack_Kick_Log (id INT NOT NULL AUTO_INCREMENT, updated LONG, playerName VARCHAR(256), motd VARCHAR(56), gameType VARCHAR(56), map VARCHAR(256), serverName VARCHAR(256), report VARCHAR(256), ping VARCHAR(25), PRIMARY KEY (id));";
private static String UPDATE_PLAYER_OFFENSES = "INSERT INTO AntiHack_Kick_Log (updated, playerName, motd, gameType, map, serverName, report, ping) VALUES (now(), ?, ?, ?, ?, ?, ?, ?);";
public AntiHackRepository(String serverName)
{
@ -72,12 +73,14 @@ public class AntiHackRepository
preparedStatement = _connection.prepareStatement(UPDATE_PLAYER_OFFENSES);
preparedStatement.setString(1, player.getName());
preparedStatement.setString(2, motd);
preparedStatement.setString(3, game);
preparedStatement.setString(4, map);
preparedStatement.setString(5, _serverName);
preparedStatement.setString(6, report);
preparedStatement.setString(7, ((CraftPlayer)player).getHandle().ping + "ms");
preparedStatement.execute();
}