Class CommonQueriesImplementation

  • All Implemented Interfaces:
    CommonQueries

    public class CommonQueriesImplementation
    extends java.lang.Object
    implements CommonQueries
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean doesDBHaveTable​(java.lang.String table)  
      boolean doesDBHaveTableColumn​(java.lang.String table, java.lang.String column)  
      double fetchActivityIndexOf​(java.util.UUID playerUUID, long epochMs)
      Calculates the activity index for the player at a specific date.
      long fetchCurrentSessionPlaytime​(java.util.UUID playerUUID)
      Get playtime of current online session.
      long fetchLastSeen​(java.util.UUID playerUUID, java.util.UUID serverUUID)
      Fetch last seen Epoch ms for a player on a server.
      java.util.Optional<java.lang.String> fetchNameOf​(java.util.UUID playerUUID)  
      long fetchPlaytime​(java.util.UUID playerUUID, java.util.UUID serverUUID, long after, long before)
      Fetch playtime of a player on a server.
      java.util.Set<java.util.UUID> fetchServerUUIDs()  
      java.util.Optional<java.util.UUID> fetchUUIDOf​(java.lang.String playerName)  
      java.lang.String getActivityGroupForIndex​(double activityIndex)
      Get a String that represents the Activity group for an index.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • fetchPlaytime

        public long fetchPlaytime​(java.util.UUID playerUUID,
                                  java.util.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​(java.util.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​(java.util.UUID playerUUID,
                                  java.util.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.
      • fetchUUIDOf

        public java.util.Optional<java.util.UUID> fetchUUIDOf​(java.lang.String playerName)
        Specified by:
        fetchUUIDOf in interface CommonQueries
      • fetchNameOf

        public java.util.Optional<java.lang.String> fetchNameOf​(java.util.UUID playerUUID)
        Specified by:
        fetchNameOf in interface CommonQueries
      • doesDBHaveTableColumn

        public boolean doesDBHaveTableColumn​(java.lang.String table,
                                             java.lang.String column)
        Specified by:
        doesDBHaveTableColumn in interface CommonQueries
      • fetchActivityIndexOf

        public double fetchActivityIndexOf​(java.util.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 java.lang.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.