From 115fc2e7ba7b0dd92668ba9507c66d0fef5f49c9 Mon Sep 17 00:00:00 2001 From: games647 Date: Sun, 4 Sep 2016 12:14:28 +0200 Subject: [PATCH] A try to fix SQLite timestamp parsing --- .../com/github/games647/fastlogin/core/AuthStorage.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java b/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java index ee464863..3c9b7bbb 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java @@ -8,6 +8,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; +import java.util.Calendar; import java.util.UUID; import java.util.logging.Level; @@ -18,6 +19,9 @@ public class AuthStorage { private final FastLoginCore core; private final HikariDataSource dataSource; + //a try to fix https://www.spigotmc.org/threads/fastlogin.101192/page-26#post-1874647 + private final Calendar calendar = Calendar.getInstance(); + public AuthStorage(FastLoginCore core, String driver, String host, int port, String databasePath , String user, String pass) { this.core = core; @@ -120,7 +124,7 @@ public class AuthStorage { boolean premium = resultSet.getBoolean(4); String lastIp = resultSet.getString(5); - long lastLogin = resultSet.getTimestamp(6).getTime(); + long lastLogin = resultSet.getTimestamp(6, calendar).getTime(); PlayerProfile playerProfile = new PlayerProfile(userId, uuid, name, premium, lastIp, lastLogin); return playerProfile; } else { @@ -154,7 +158,7 @@ public class AuthStorage { String name = resultSet.getString(3); boolean premium = resultSet.getBoolean(4); String lastIp = resultSet.getString(5); - long lastLogin = resultSet.getTimestamp(6).getTime(); + long lastLogin = resultSet.getTimestamp(6, calendar).getTime(); PlayerProfile playerProfile = new PlayerProfile(userId, uuid, name, premium, lastIp, lastLogin); return playerProfile; }