forked from SteamWar/SteamWar
Add LastOnline to WhoisCommand
This commit is contained in:
@@ -73,6 +73,7 @@ public class SteamwarUser {
|
||||
|
||||
private static final Statement getPlaytime = new Statement("SELECT SUM(UNIX_TIMESTAMP(EndTime) - UNIX_TIMESTAMP(StartTime)) as Playtime FROM Session WHERE UserID = ?");
|
||||
private static final Statement getFirstjoin = new Statement("SELECT MIN(StartTime) AS FirstJoin FROM Session WHERE UserID = ?");
|
||||
private static final Statement getLastonline = new Statement("SELECT MAX(EndTime) AS LastOnline FROM Session WHERE UserID = ?");
|
||||
|
||||
private static final Map<Integer, SteamwarUser> usersById = new HashMap<>();
|
||||
private static final Map<UUID, SteamwarUser> usersByUUID = new HashMap<>();
|
||||
@@ -276,6 +277,14 @@ public class SteamwarUser {
|
||||
}, id);
|
||||
}
|
||||
|
||||
public Timestamp getLastOnline() {
|
||||
return getLastonline.select(rs -> {
|
||||
if (rs.next())
|
||||
return rs.getTimestamp("LastOnline");
|
||||
return null;
|
||||
}, id);
|
||||
}
|
||||
|
||||
public void punish(Punishment.PunishmentType punishment, Timestamp time, String banReason, int from, boolean perma) {
|
||||
initPunishments();
|
||||
punishments.remove(punishment);
|
||||
|
||||
Reference in New Issue
Block a user