From 8d8946287c05b44659412a78937420663e17fa7a Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Sun, 8 Oct 2017 10:55:53 +0300 Subject: [PATCH] Fixes #346 --- Plan/src/main/java/com/djrapitops/plan/ShutdownHook.java | 8 ++++---- .../java/com/djrapitops/plan/data/time/WorldTimes.java | 4 ++++ .../djrapitops/plan/database/tables/UserInfoTable.java | 2 +- .../plan/utilities/html/tables/SessionsTableCreator.java | 4 ++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/ShutdownHook.java b/Plan/src/main/java/com/djrapitops/plan/ShutdownHook.java index 56605cc90..97f3d40e0 100644 --- a/Plan/src/main/java/com/djrapitops/plan/ShutdownHook.java +++ b/Plan/src/main/java/com/djrapitops/plan/ShutdownHook.java @@ -72,14 +72,14 @@ public class ShutdownHook extends Thread { } private void saveFirstSessionInformation(long now) { - try { - for (Map.Entry entry : dataCache.getFirstSessionMsgCounts().entrySet()) { + for (Map.Entry entry : dataCache.getFirstSessionMsgCounts().entrySet()) { + try { UUID uuid = entry.getKey(); int messagesSent = entry.getValue(); db.getActionsTable().insertAction(uuid, new Action(now, Actions.FIRST_LOGOUT, "Messages sent: " + messagesSent)); + } catch (SQLException e) { + Log.toLog(this.getClass().getName(), e); } - } catch (SQLException e) { - Log.toLog(this.getClass().getName(), e); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java b/Plan/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java index c513cc580..3e51d66f0 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java @@ -154,4 +154,8 @@ public class WorldTimes { b.append("}"); return b.toString(); } + + public String getCurrentWorld() { + return currentWorld; + } } diff --git a/Plan/src/main/java/com/djrapitops/plan/database/tables/UserInfoTable.java b/Plan/src/main/java/com/djrapitops/plan/database/tables/UserInfoTable.java index 74589c122..d37d05f66 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/tables/UserInfoTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/database/tables/UserInfoTable.java @@ -88,7 +88,7 @@ public class UserInfoTable extends UserIDTable { public boolean isRegistered(UUID uuid, UUID serverUUID) throws SQLException { String sql = Select.from(tableName, "COUNT(" + columnUserID + ") as c") .where(columnUserID + "=" + usersTable.statementSelectID) - .where(columnServerID + "=" + serverTable.statementSelectServerID) + .and(columnServerID + "=" + serverTable.statementSelectServerID) .toString(); return query(new QueryStatement(sql) { diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/SessionsTableCreator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/SessionsTableCreator.java index 4c2899760..43194e9f9 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/SessionsTableCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/SessionsTableCreator.java @@ -91,6 +91,10 @@ public class SessionsTableCreator { } private static String getLongestWorldPlayed(Session session) { + if (session.getSessionEnd() == -1) { + return "Current: " + session.getWorldTimes().getCurrentWorld(); + } + WorldTimes worldTimes = session.getWorldTimes(); long total = worldTimes.getTotal(); long longest = 0;