Fixup lastLogin in database

This commit is contained in:
RedSparr0w 2020-02-25 19:21:12 +13:00
parent 3a370a0292
commit c712be33d8
4 changed files with 5 additions and 4 deletions

View file

@ -191,10 +191,11 @@ public final class PlayerSession {
} }
PreparedStatement statement; PreparedStatement statement;
try { try {
statement = connection.prepareStatement("UPDATE members SET online = ? AND lastWorld = ? WHERE username = ?"); statement = connection.prepareStatement("UPDATE members SET online = ?, lastWorld = ?, lastLogin = ? WHERE username = ?");
statement.setBoolean(1, true); statement.setBoolean(1, true);
statement.setInt(2, worldId); statement.setInt(2, worldId);
statement.setString(3, username); statement.setLong(3, System.currentTimeMillis());
statement.setString(4, username);
statement.execute(); statement.execute();
SQLManager.close(connection); SQLManager.close(connection);
} catch (SQLException e) { } catch (SQLException e) {

View file

@ -86,7 +86,7 @@ public final class PlayerSQLManager {
details.getShop().parsePerks((String) table.getColumn("perks").getValue()); details.getShop().parsePerks((String) table.getColumn("perks").getValue());
details.setRights(Rights.forId((int) table.getColumn("rights").getValue())); details.setRights(Rights.forId((int) table.getColumn("rights").getValue()));
details.setDonatorType(DonatorType.forId((int) table.getColumn("donatorType").getValue())); details.setDonatorType(DonatorType.forId((int) table.getColumn("donatorType").getValue()));
details.setLastLogin((long) table.getColumn("lastLogin").getValue()); details.setLastLogin(System.currentTimeMillis());
return true; return true;
} }
@ -106,7 +106,7 @@ public final class PlayerSQLManager {
details.getCommunication().save(table); details.getCommunication().save(table);
} }
table.getColumn("bank").updateValue(player.getBank().format()); table.getColumn("bank").updateValue(player.getBank().format());
table.getColumn("lastLogin").updateValue(System.currentTimeMillis()); table.getColumn("lastLogin").updateValue(player.getDetails().getLastLogin());
table.getColumn("ge").updateValue(player.getGrandExchange().format()); table.getColumn("ge").updateValue(player.getGrandExchange().format());
table.getColumn("inventory").updateValue(player.getInventory().format()); table.getColumn("inventory").updateValue(player.getInventory().format());
table.getColumn("equipment").updateValue(player.getEquipment().format()); table.getColumn("equipment").updateValue(player.getEquipment().format());