diff --git a/CompiledServer/production/RS-2009/org/crandor/game/node/entity/player/info/PlayerDetails.class b/CompiledServer/production/RS-2009/org/crandor/game/node/entity/player/info/PlayerDetails.class index 83cf56620..ba559d635 100644 Binary files a/CompiledServer/production/RS-2009/org/crandor/game/node/entity/player/info/PlayerDetails.class and b/CompiledServer/production/RS-2009/org/crandor/game/node/entity/player/info/PlayerDetails.class differ diff --git a/CompiledServer/production/RS-2009/org/crandor/game/node/entity/player/info/portal/PlayerSQLManager.class b/CompiledServer/production/RS-2009/org/crandor/game/node/entity/player/info/portal/PlayerSQLManager.class index 542f7c3f6..51db9abe6 100644 Binary files a/CompiledServer/production/RS-2009/org/crandor/game/node/entity/player/info/portal/PlayerSQLManager.class and b/CompiledServer/production/RS-2009/org/crandor/game/node/entity/player/info/portal/PlayerSQLManager.class differ diff --git a/CompiledServer/production/RS-2009/org/keldagrim/world/PlayerSession.class b/CompiledServer/production/RS-2009/org/keldagrim/world/PlayerSession.class index 18ca9aa28..206f9bd38 100644 Binary files a/CompiledServer/production/RS-2009/org/keldagrim/world/PlayerSession.class and b/CompiledServer/production/RS-2009/org/keldagrim/world/PlayerSession.class differ diff --git a/Management-Server/src/org/keldagrim/world/PlayerSession.java b/Management-Server/src/org/keldagrim/world/PlayerSession.java index 3ed27da74..8b6db6ca8 100644 --- a/Management-Server/src/org/keldagrim/world/PlayerSession.java +++ b/Management-Server/src/org/keldagrim/world/PlayerSession.java @@ -191,10 +191,11 @@ public final class PlayerSession { } PreparedStatement statement; 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.setInt(2, worldId); - statement.setString(3, username); + statement.setLong(3, System.currentTimeMillis()); + statement.setString(4, username); statement.execute(); SQLManager.close(connection); } catch (SQLException e) { diff --git a/Server/src/org/crandor/game/node/entity/player/info/PlayerDetails.java b/Server/src/org/crandor/game/node/entity/player/info/PlayerDetails.java index 2041b3cf6..b01eb1cc9 100644 --- a/Server/src/org/crandor/game/node/entity/player/info/PlayerDetails.java +++ b/Server/src/org/crandor/game/node/entity/player/info/PlayerDetails.java @@ -50,11 +50,16 @@ public class PlayerDetails { * The unique id of the account. */ private int uid; - + /** * The account's last game login. */ private long lastLogin = -1; + + /** + * The account's last game login. + */ + private long timePlayed = 0; /** * The time the player is muted for. @@ -370,7 +375,7 @@ public class PlayerDetails { public void setIcon(Icon icon) { this.icon = icon; } - + /** * Gets the lastLogin. * @return the lastLogin. @@ -386,6 +391,22 @@ public class PlayerDetails { public void setLastLogin(long lastLogin) { this.lastLogin = lastLogin; } + + /** + * Gets the timePlayed. + * @return the timePlayed. + */ + public long getTimePlayed() { + return timePlayed; + } + + /** + * Sets the timePlayed. + * @param timePlayed the timePlayed to set + */ + public void setTimePlayed(long timePlayed) { + this.timePlayed = timePlayed; + } /** * Sets the mute time. diff --git a/Server/src/org/crandor/game/node/entity/player/info/portal/PlayerSQLManager.java b/Server/src/org/crandor/game/node/entity/player/info/portal/PlayerSQLManager.java index f81479a3f..ce4b24abb 100644 --- a/Server/src/org/crandor/game/node/entity/player/info/portal/PlayerSQLManager.java +++ b/Server/src/org/crandor/game/node/entity/player/info/portal/PlayerSQLManager.java @@ -86,7 +86,8 @@ public final class PlayerSQLManager { details.getShop().parsePerks((String) table.getColumn("perks").getValue()); details.setRights(Rights.forId((int) table.getColumn("rights").getValue())); details.setDonatorType(DonatorType.forId((int) table.getColumn("donatorType").getValue())); - details.setLastLogin((long) table.getColumn("lastLogin").getValue()); + details.setLastLogin(System.currentTimeMillis()); + details.setTimePlayed((long) table.getColumn("timePlayed").getValue()); return true; } @@ -106,14 +107,15 @@ public final class PlayerSQLManager { details.getCommunication().save(table); } 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("inventory").updateValue(player.getInventory().format()); table.getColumn("equipment").updateValue(player.getEquipment().format()); table.getColumn("netWorth").updateValue(player.getMonitor().getNetworth()); table.getColumn("lastGameIp").updateValue(player.getDetails().getIpAddress()); table.getColumn("ironManMode").updateValue(player.getIronmanManager().getMode().name()); - table.getColumn("timePlayed").updateValue((long) table.getColumn("timePlayed").getValue() + (System.currentTimeMillis() - player.getAttribute("startTime", System.currentTimeMillis()))); table.getColumn("ip").updateValue(getAddressLog((String) table.getColumn("ip").getValue(), details.getInfo().getIp())); + table.getColumn("timePlayed").updateValue(player.getDetails().getTimePlayed() + (System.currentTimeMillis() - player.getDetails().getLastLogin())); + table.getColumn("ip").updateValue(getAddressLog((String) table.getColumn("ip").getValue(), details.getInfo().getIp())); table.getColumn("mac").updateValue(getAddressLog((String) table.getColumn("mac").getValue(), details.getInfo().getMac())); table.getColumn("serial").updateValue(getAddressLog((String) table.getColumn("serial").getValue(), details.getInfo().getSerial())); table.getColumn("computerName").updateValue(getAddressLog((String) table.getColumn("computerName").getValue(), details.getInfo().getCompName()));