SteamWar/SpigotCore
Archiviert
13
0

Add SteanwarUser.getOnlineTime

Dieser Commit ist enthalten in:
jojo 2020-10-25 08:14:36 +01:00
Ursprung 74c3a5ab41
Commit 8a375346d7

Datei anzeigen

@ -88,6 +88,17 @@ public class SteamwarUser {
return bedrock;
}
public double getOnlineTime() {
ResultSet set = SQL.select("SELECT SUM(UNIX_TIMESTAMP(EndTime) - UNIX_TIMESTAMP(StartTime)) as Playtime FROM Session WHERE UserID = ?", id);
try {
set.next();
return set.getBigDecimal("Playtime").doubleValue();
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return 0;
}
private static SteamwarUser fromDB(String statement, Object identifier){
ResultSet rs = SQL.select(statement, identifier);
try {