Add timePlayed to playerDetails

This commit is contained in:
RedSparr0w 2020-02-26 12:34:36 +13:00
parent 7b0ae33151
commit 0403b685a9
4 changed files with 25 additions and 3 deletions

View file

@ -56,6 +56,11 @@ public class PlayerDetails {
*/ */
private long lastLogin = -1; private long lastLogin = -1;
/**
* The account's last game login.
*/
private long timePlayed = 0;
/** /**
* The time the player is muted for. * The time the player is muted for.
*/ */
@ -387,6 +392,22 @@ public class PlayerDetails {
this.lastLogin = 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. * Sets the mute time.
* @param muteTime the mute time. * @param muteTime the mute time.

View file

@ -87,6 +87,7 @@ public final class PlayerSQLManager {
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(System.currentTimeMillis()); details.setLastLogin(System.currentTimeMillis());
details.setTimePlayed((long) table.getColumn("timePlayed").getValue());
return true; return true;
} }
@ -113,7 +114,7 @@ public final class PlayerSQLManager {
table.getColumn("netWorth").updateValue(player.getMonitor().getNetworth()); table.getColumn("netWorth").updateValue(player.getMonitor().getNetworth());
table.getColumn("lastGameIp").updateValue(player.getDetails().getIpAddress()); table.getColumn("lastGameIp").updateValue(player.getDetails().getIpAddress());
table.getColumn("ironManMode").updateValue(player.getIronmanManager().getMode().name()); table.getColumn("ironManMode").updateValue(player.getIronmanManager().getMode().name());
table.getColumn("timePlayed").updateValue((long) table.getColumn("timePlayed").getValue() + (System.currentTimeMillis() - player.getDetails().getLastLogin())); 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("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("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("serial").updateValue(getAddressLog((String) table.getColumn("serial").getValue(), details.getInfo().getSerial()));