java.lang.Object
com.djrapitops.plan.storage.database.queries.objects.SessionQueries

public class SessionQueries extends Object
Queries for FinishedSession objects.
  • Method Details

    • fetchAllSessions

      public static Query<List<FinishedSession>> fetchAllSessions()
      Query the database for Session data with kill, death or world data.
      Returns:
      List of sessions
    • fetchSessionsOfPlayer

      public static Query<Map<ServerUUID,List<FinishedSession>>> fetchSessionsOfPlayer(UUID playerUUID)
      Query the database for Session data of a player with kill and world data.
      Parameters:
      playerUUID - UUID of the Player.
      Returns:
      Map: Server UUID - List of sessions on the server.
    • fetchServerSessionsWithoutKillOrWorldData

      public static Query<List<FinishedSession>> fetchServerSessionsWithoutKillOrWorldData(long after, long before, ServerUUID serverUUID)
    • fetchLatestSessionsOfServer

      public static Query<List<FinishedSession>> fetchLatestSessionsOfServer(ServerUUID serverUUID, int limit)
    • fetchLatestSessions

      public static Query<List<FinishedSession>> fetchLatestSessions(int limit)
    • sessionCount

      public static Query<Long> sessionCount(long after, long before, ServerUUID serverUUID)
    • sessionCount

      public static Query<Long> sessionCount(long after, long before)
    • sessionCountPerDay

      public static Query<NavigableMap<Long,Integer>> sessionCountPerDay(long after, long before, long timeZoneOffset, ServerUUID serverUUID)
      Query session count for each day within range on a server.
      Parameters:
      after - After epoch ms
      before - Before epoch ms
      timeZoneOffset - Offset in ms to determine start of day.
      serverUUID - UUID of the Plan server.
      Returns:
      Map - Epoch ms (Start of day at 0 AM, no offset) : Session count of that day
    • sessionCountPerDay

      public static Query<NavigableMap<Long,Integer>> sessionCountPerDay(long after, long before, long timeZoneOffset)
      Query session count for each day within range across the whole network.
      Parameters:
      after - After epoch ms
      before - Before epoch ms
      timeZoneOffset - Offset in ms to determine start of day.
      Returns:
      Map - Epoch ms (Start of day at 0 AM, no offset) : Session count of that day
    • playtime

      public static Query<Long> playtime(long after, long before, ServerUUID serverUUID)
    • playtimeOfPlayer

      public static Query<Map<ServerUUID,Long>> playtimeOfPlayer(long after, long before, UUID playerUUID)
    • playtime

      public static Query<Long> playtime(long after, long before)
    • playtimePerDay

      public static Query<NavigableMap<Long,Long>> playtimePerDay(long after, long before, long timeZoneOffset, ServerUUID serverUUID)
      Query playtime for each day within range on a server.
      Parameters:
      after - After epoch ms
      before - Before epoch ms
      timeZoneOffset - Offset in ms to determine start of day.
      serverUUID - UUID of the Plan server.
      Returns:
      Map - Epoch ms (Start of day at 0 AM, no offset) : Playtime of that day
    • playtimePerDay

      public static Query<NavigableMap<Long,Long>> playtimePerDay(long after, long before, long timeZoneOffset)
      Query playtime for each day within range across the whole network.
      Parameters:
      after - After epoch ms
      before - Before epoch ms
      timeZoneOffset - Offset in ms to determine start of day.
      Returns:
      Map - Epoch ms (Start of day at 0 AM, no offset) : Playtime of that day
    • averagePlaytimePerDay

      public static Query<Long> averagePlaytimePerDay(long after, long before, long timeZoneOffset, ServerUUID serverUUID)
    • averagePlaytimePerPlayer

      public static Query<Long> averagePlaytimePerPlayer(long after, long before, ServerUUID serverUUID)
    • averagePlaytimePerPlayer

      public static Query<Long> averagePlaytimePerPlayer(long after, long before)
      Fetch average playtime per ALL players.
      Parameters:
      after - After epoch ms
      before - Before epoch ms
      Returns:
      Average ms played / player, calculated with grouped sums from sessions table.
    • averageAfkPerPlayer

      public static Query<Long> averageAfkPerPlayer(long after, long before, ServerUUID serverUUID)
    • averageAfkPerPlayer

      public static Query<Long> averageAfkPerPlayer(long after, long before)
      Fetch average Afk per ALL players.
      Parameters:
      after - After epoch ms
      before - Before epoch ms
      Returns:
      Average ms afk / player, calculated with grouped sums from sessions table.
    • afkTime

      public static Query<Long> afkTime(long after, long before, ServerUUID serverUUID)
    • afkTime

      public static Query<Long> afkTime(long after, long before)
    • playtimePerServer

      public static Query<Map<String,Long>> playtimePerServer(long after, long before)
    • lastSeen

      public static Query<Long> lastSeen(UUID playerUUID)
    • lastSeen

      public static Query<Long> lastSeen(UUID playerUUID, ServerUUID serverUUID)
    • activePlaytime

      public static Query<Long> activePlaytime(long after, long before, ServerUUID serverUUID)
    • activePlaytime

      public static Query<Long> activePlaytime(long after, long before)
    • userIdsOfPlayedBetween

      public static Query<Set<Integer>> userIdsOfPlayedBetween(long after, long before, List<ServerUUID> serverUUIDs)
    • summaryOfPlayers

      public static Query<Map<String,Long>> summaryOfPlayers(Set<Integer> userIds, List<ServerUUID> serverUUIDs, long after, long before)
    • earliestSessionStart

      public static Query<Long> earliestSessionStart()
    • lastSeen

      public static Query<Map<UUID,Long>> lastSeen(ServerUUID serverUUID)