mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-13 11:41:34 +01:00
Fixed Last Seen on inspect page
This commit is contained in:
parent
f3ac5067b3
commit
aaaa634638
@ -493,4 +493,24 @@ public class SessionsTable extends UserIDTable {
|
||||
close(set, statement);
|
||||
}
|
||||
}
|
||||
|
||||
public long getLastSeen(UUID uuid) throws SQLException {
|
||||
PreparedStatement statement = null;
|
||||
ResultSet set = null;
|
||||
try {
|
||||
statement = prepareStatement("SELECT" +
|
||||
" MAX(" + columnSessionEnd + ") as last_seen" +
|
||||
" FROM " + tableName +
|
||||
" WHERE " + columnUserID + "=" + usersTable.statementSelectID);
|
||||
statement.setString(1, uuid.toString());
|
||||
set = statement.executeQuery();
|
||||
if (set.next()) {
|
||||
return set.getLong("last_seen");
|
||||
}
|
||||
return 0;
|
||||
} finally {
|
||||
endTransaction(statement);
|
||||
close(set, statement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,9 +53,12 @@ public class InspectPageParser {
|
||||
}
|
||||
|
||||
public String parse() throws SQLException, FileNotFoundException {
|
||||
// TODO Player is online parts
|
||||
Log.debug("Database", "Inspect Parse Fetch");
|
||||
Benchmark.start("Inspect Parse, Fetch");
|
||||
Database db = plugin.getDB();
|
||||
SessionsTable sessionsTable = db.getSessionsTable();
|
||||
|
||||
UserInfo userInfo = db.getUserInfoTable().getUserInfo(uuid);
|
||||
int timesKicked = db.getUsersTable().getTimesKicked(uuid);
|
||||
|
||||
@ -64,11 +67,14 @@ public class InspectPageParser {
|
||||
|
||||
addValue("playerName", userInfo.getName());
|
||||
addValue("registered", FormatUtils.formatTimeStampYear(userInfo.getRegistered()));
|
||||
long lastSeen = userInfo.getLastSeen();
|
||||
addValue("lastSeen", FormatUtils.formatTimeStampYear(lastSeen));
|
||||
long lastSeen = sessionsTable.getLastSeen(uuid);
|
||||
if (lastSeen != 0) {
|
||||
addValue("lastSeen", FormatUtils.formatTimeStampYear(lastSeen));
|
||||
} else {
|
||||
addValue("lastSeen", "-");
|
||||
}
|
||||
addValue("kickCount", timesKicked);
|
||||
|
||||
SessionsTable sessionsTable = db.getSessionsTable();
|
||||
Map<String, Long> playtimeByServer = sessionsTable.getPlaytimeByServer(uuid);
|
||||
|
||||
List<String> geolocations = db.getIpsTable().getGeolocations(uuid);
|
||||
|
Loading…
Reference in New Issue
Block a user