This commit is contained in:
Rsl1122 2017-10-08 10:55:53 +03:00
parent 99bd4fed06
commit 8d8946287c
4 changed files with 13 additions and 5 deletions

View File

@ -72,16 +72,16 @@ public class ShutdownHook extends Thread {
} }
private void saveFirstSessionInformation(long now) { private void saveFirstSessionInformation(long now) {
try {
for (Map.Entry<UUID, Integer> entry : dataCache.getFirstSessionMsgCounts().entrySet()) { for (Map.Entry<UUID, Integer> entry : dataCache.getFirstSessionMsgCounts().entrySet()) {
try {
UUID uuid = entry.getKey(); UUID uuid = entry.getKey();
int messagesSent = entry.getValue(); int messagesSent = entry.getValue();
db.getActionsTable().insertAction(uuid, new Action(now, Actions.FIRST_LOGOUT, "Messages sent: " + messagesSent)); db.getActionsTable().insertAction(uuid, new Action(now, Actions.FIRST_LOGOUT, "Messages sent: " + messagesSent));
}
} catch (SQLException e) { } catch (SQLException e) {
Log.toLog(this.getClass().getName(), e); Log.toLog(this.getClass().getName(), e);
} }
} }
}
private void saveActiveSessions(Map<UUID, Session> activeSessions, long now) { private void saveActiveSessions(Map<UUID, Session> activeSessions, long now) {
SessionsTable sessionsTable = db.getSessionsTable(); SessionsTable sessionsTable = db.getSessionsTable();

View File

@ -154,4 +154,8 @@ public class WorldTimes {
b.append("}"); b.append("}");
return b.toString(); return b.toString();
} }
public String getCurrentWorld() {
return currentWorld;
}
} }

View File

@ -88,7 +88,7 @@ public class UserInfoTable extends UserIDTable {
public boolean isRegistered(UUID uuid, UUID serverUUID) throws SQLException { public boolean isRegistered(UUID uuid, UUID serverUUID) throws SQLException {
String sql = Select.from(tableName, "COUNT(" + columnUserID + ") as c") String sql = Select.from(tableName, "COUNT(" + columnUserID + ") as c")
.where(columnUserID + "=" + usersTable.statementSelectID) .where(columnUserID + "=" + usersTable.statementSelectID)
.where(columnServerID + "=" + serverTable.statementSelectServerID) .and(columnServerID + "=" + serverTable.statementSelectServerID)
.toString(); .toString();
return query(new QueryStatement<Boolean>(sql) { return query(new QueryStatement<Boolean>(sql) {

View File

@ -91,6 +91,10 @@ public class SessionsTableCreator {
} }
private static String getLongestWorldPlayed(Session session) { private static String getLongestWorldPlayed(Session session) {
if (session.getSessionEnd() == -1) {
return "Current: " + session.getWorldTimes().getCurrentWorld();
}
WorldTimes worldTimes = session.getWorldTimes(); WorldTimes worldTimes = session.getWorldTimes();
long total = worldTimes.getTotal(); long total = worldTimes.getTotal();
long longest = 0; long longest = 0;