Add SteanwarUser.getOnlineTime
Dieser Commit ist enthalten in:
Ursprung
74c3a5ab41
Commit
8a375346d7
@ -88,6 +88,17 @@ public class SteamwarUser {
|
|||||||
return bedrock;
|
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){
|
private static SteamwarUser fromDB(String statement, Object identifier){
|
||||||
ResultSet rs = SQL.select(statement, identifier);
|
ResultSet rs = SQL.select(statement, identifier);
|
||||||
try {
|
try {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren