forked from TuxCoding/FastLogin
A try to fix SQLite timestamp parsing
This commit is contained in:
@@ -8,6 +8,7 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@@ -18,6 +19,9 @@ public class AuthStorage {
|
|||||||
private final FastLoginCore core;
|
private final FastLoginCore core;
|
||||||
private final HikariDataSource dataSource;
|
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
|
public AuthStorage(FastLoginCore core, String driver, String host, int port, String databasePath
|
||||||
, String user, String pass) {
|
, String user, String pass) {
|
||||||
this.core = core;
|
this.core = core;
|
||||||
@@ -120,7 +124,7 @@ public class AuthStorage {
|
|||||||
|
|
||||||
boolean premium = resultSet.getBoolean(4);
|
boolean premium = resultSet.getBoolean(4);
|
||||||
String lastIp = resultSet.getString(5);
|
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);
|
PlayerProfile playerProfile = new PlayerProfile(userId, uuid, name, premium, lastIp, lastLogin);
|
||||||
return playerProfile;
|
return playerProfile;
|
||||||
} else {
|
} else {
|
||||||
@@ -154,7 +158,7 @@ public class AuthStorage {
|
|||||||
String name = resultSet.getString(3);
|
String name = resultSet.getString(3);
|
||||||
boolean premium = resultSet.getBoolean(4);
|
boolean premium = resultSet.getBoolean(4);
|
||||||
String lastIp = resultSet.getString(5);
|
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);
|
PlayerProfile playerProfile = new PlayerProfile(userId, uuid, name, premium, lastIp, lastLogin);
|
||||||
return playerProfile;
|
return playerProfile;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user