修复登录记录数据库错误问题
All checks were successful
Java CI-CD with Maven / build (push) Successful in 7m29s

This commit is contained in:
zhangyuheng 2024-06-17 14:51:43 +08:00
parent af7223c27f
commit cb9716e7b0
2 changed files with 4 additions and 3 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId> <groupId>cn.lunadeer</groupId>
<artifactId>EssentialsD</artifactId> <artifactId>EssentialsD</artifactId>
<version>1.22.0</version> <version>1.22.1</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>EssentialsD</name> <name>EssentialsD</name>

View File

@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.UUID; import java.util.UUID;
public class LoginRecord { public class LoginRecord {
@ -32,8 +33,8 @@ public class LoginRecord {
} else { } else {
ip = address.getAddress().getHostAddress(); ip = address.getAddress().getHostAddress();
} }
long login_time = player.getLastLogin(); Timestamp login_time = new Timestamp(player.getLastLogin());
long logout_time = System.currentTimeMillis(); Timestamp logout_time = new Timestamp(System.currentTimeMillis());
String logout_location = LocationUtils.Serialize(player.getLocation()); String logout_location = LocationUtils.Serialize(player.getLocation());
String sql = "INSERT INTO login_record (uuid, ip, login_time, logout_location, logout_time) " + String sql = "INSERT INTO login_record (uuid, ip, login_time, logout_location, logout_time) " +
"VALUES (?, ?, ?, ?, ?);"; "VALUES (?, ?, ?, ?, ?);";