2018-07-06 15:30:00 +02:00
|
|
|
package com.eu.habbo.core;
|
|
|
|
|
|
|
|
import com.eu.habbo.Emulator;
|
|
|
|
import com.eu.habbo.habbohotel.commands.Command;
|
|
|
|
|
|
|
|
import java.sql.PreparedStatement;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public class CommandLog implements Loggable {
|
2019-03-18 02:22:00 +01:00
|
|
|
public static final String insertQuery = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)";
|
2018-07-06 15:30:00 +02:00
|
|
|
|
|
|
|
private final int userId;
|
|
|
|
private final int timestamp = Emulator.getIntUnixTimestamp();
|
|
|
|
private final Command command;
|
|
|
|
private final String params;
|
|
|
|
private final boolean succes;
|
|
|
|
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public CommandLog(int userId, Command command, String params, boolean succes) {
|
2018-07-06 15:30:00 +02:00
|
|
|
this.userId = userId;
|
|
|
|
this.command = command;
|
|
|
|
this.params = params;
|
|
|
|
this.succes = succes;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-26 20:14:53 +02:00
|
|
|
public void log(PreparedStatement statement) throws SQLException {
|
2018-07-06 15:30:00 +02:00
|
|
|
statement.setInt(1, this.userId);
|
|
|
|
statement.setInt(2, this.timestamp);
|
|
|
|
statement.setString(3, this.command.getClass().getSimpleName());
|
|
|
|
statement.setString(4, this.params);
|
|
|
|
statement.setString(5, this.succes ? "yes" : "no");
|
|
|
|
statement.addBatch();
|
|
|
|
}
|
|
|
|
}
|