mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-07-04 14:25:32 +02:00
38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
![]() |
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;
|
||
|
|
||
|
public class CommandLog implements Loggable
|
||
|
{
|
||
|
public static String insertQuery = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)";
|
||
|
|
||
|
private final int userId;
|
||
|
private final int timestamp = Emulator.getIntUnixTimestamp();
|
||
|
private final Command command;
|
||
|
private final String params;
|
||
|
private final boolean succes;
|
||
|
|
||
|
|
||
|
public CommandLog(int userId, Command command, String params, boolean succes)
|
||
|
{
|
||
|
this.userId = userId;
|
||
|
this.command = command;
|
||
|
this.params = params;
|
||
|
this.succes = succes;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void log(PreparedStatement statement) throws SQLException
|
||
|
{
|
||
|
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();
|
||
|
}
|
||
|
}
|