Class CommonQueriesImplementation

java.lang.Object
com.djrapitops.plan.query.CommonQueriesImplementation
All Implemented Interfaces:
CommonQueries

public class CommonQueriesImplementation extends Object implements CommonQueries
  • Method Details

    • fetchPlaytime

      public long fetchPlaytime(UUID playerUUID, UUID serverUUID, long after, long before)
      Description copied from interface: CommonQueries
      Fetch playtime of a player on a server.

      Returns 0 for any non existing players or servers.

      Specified by:
      fetchPlaytime in interface CommonQueries
      Parameters:
      playerUUID - UUID of the player.
      serverUUID - UUID of the Plan server.
      after - Data after this Epoch ms should be fetched
      before - Data before this Epoch ms should be fetched
      Returns:
      Milliseconds the player has played with the defined parameters.
    • fetchCurrentSessionPlaytime

      public long fetchCurrentSessionPlaytime(UUID playerUUID)
      Description copied from interface: CommonQueries
      Get playtime of current online session.

      Requires Capability QUERY_API_ACTIVE_SESSION_PLAYTIME

      Specified by:
      fetchCurrentSessionPlaytime in interface CommonQueries
      Parameters:
      playerUUID - UUID of the player.
      Returns:
      Milliseconds the player has played during current online session. 0 if player is offline.
    • fetchLastSeen

      public long fetchLastSeen(UUID playerUUID, UUID serverUUID)
      Description copied from interface: CommonQueries
      Fetch last seen Epoch ms for a player on a server.
      Specified by:
      fetchLastSeen in interface CommonQueries
      Parameters:
      playerUUID - UUID of the player.
      serverUUID - UUID of the Plan server.
      Returns:
      Epoch ms the player was last seen, 0 if player has not played on server.
    • fetchServerUUIDs

      public Set<UUID> fetchServerUUIDs()
      Description copied from interface: CommonQueries
      Get the UUIDs of all servers Plan has registered.
      Specified by:
      fetchServerUUIDs in interface CommonQueries
      Returns:
      Set of Server UUIDs
    • fetchUUIDOf

      public Optional<UUID> fetchUUIDOf(String playerName)
      Description copied from interface: CommonQueries
      Fetch UUID of a player by name.
      Specified by:
      fetchUUIDOf in interface CommonQueries
      Parameters:
      playerName - Name of the player
      Returns:
      UUID if it is found by Plan or empty if not found.
    • fetchNameOf

      public Optional<String> fetchNameOf(UUID playerUUID)
      Description copied from interface: CommonQueries
      Fetch name of a player by UUID.
      Specified by:
      fetchNameOf in interface CommonQueries
      Parameters:
      playerUUID - UUID of the player
      Returns:
      Name if it is known by Plan or empty if not.
    • doesDBHaveTable

      public boolean doesDBHaveTable(String table)
      Description copied from interface: CommonQueries
      Check that schema has table you are using in your queries.
      Specified by:
      doesDBHaveTable in interface CommonQueries
      Parameters:
      table - Name of the table, e.g. plan_users.
      Returns:
      true if table exists.
    • doesDBHaveTableColumn

      public boolean doesDBHaveTableColumn(String table, String column)
      Description copied from interface: CommonQueries
      Check that schema table has a column you are using in your queries.
      Specified by:
      doesDBHaveTableColumn in interface CommonQueries
      Parameters:
      table - Name of the table, e.g. plan_users.
      column - Name of the column, e.g. id
      Returns:
      true if table and column exist.
    • fetchActivityIndexOf

      public double fetchActivityIndexOf(UUID playerUUID, long epochMs)
      Description copied from interface: CommonQueries
      Calculates the activity index for the player at a specific date.
      Specified by:
      fetchActivityIndexOf in interface CommonQueries
      Parameters:
      playerUUID - UUID of the player.
      epochMs - Epoch millisecond to use for calculation
      Returns:
      a double between 0.0 and 5.0.
    • getActivityGroupForIndex

      public String getActivityGroupForIndex(double activityIndex)
      Description copied from interface: CommonQueries
      Get a String that represents the Activity group for an index.
      Specified by:
      getActivityGroupForIndex in interface CommonQueries
      Parameters:
      activityIndex - a double between 0.0 and 5.0.
      Returns:
      Name of the group (in English) that this activityIndex falls within.