Package com.djrapitops.plan.query
Interface CommonQueries
- All Known Implementing Classes:
CommonQueriesImplementation
public interface CommonQueries
Class that allows performing most commonly wanted queries.
This exists so that SQL does not necessarily need to be written.
Obtain an instance from QueryService
.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
doesDBHaveTable(String table)
boolean
doesDBHaveTableColumn(String table, String column)
double
fetchActivityIndexOf(UUID playerUUID, long epochMs)
Calculates the activity index for the player at a specific date.long
fetchCurrentSessionPlaytime(UUID playerUUID)
Get playtime of current online session.long
fetchLastSeen(UUID playerUUID, UUID serverUUID)
Fetch last seen Epoch ms for a player on a server.fetchNameOf(UUID playerUUID)
long
fetchPlaytime(UUID playerUUID, UUID serverUUID, long after, long before)
Fetch playtime of a player on a server.fetchUUIDOf(String playerName)
getActivityGroupForIndex(double activityIndex)
Get a String that represents the Activity group for an index.
-
Method Details
-
fetchPlaytime
Fetch playtime of a player on a server.Returns 0 for any non existing players or servers.
- Parameters:
playerUUID
- UUID of the player.serverUUID
- UUID of the Plan server.after
- Data after this Epoch ms should be fetchedbefore
- Data before this Epoch ms should be fetched- Returns:
- Milliseconds the player has played with the defined parameters.
-
fetchCurrentSessionPlaytime
Get playtime of current online session.Requires Capability QUERY_API_ACTIVE_SESSION_PLAYTIME
- Parameters:
playerUUID
- UUID of the player.- Returns:
- Milliseconds the player has played during current online session. 0 if player is offline.
-
fetchLastSeen
Fetch last seen Epoch ms for a player on a server.- 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
-
fetchUUIDOf
-
fetchNameOf
-
doesDBHaveTable
-
doesDBHaveTableColumn
-
fetchActivityIndexOf
Calculates the activity index for the player at a specific date.- Parameters:
playerUUID
- UUID of the player.epochMs
- Epoch millisecond to use for calculation- Returns:
- a double between 0.0 and 5.0.
-
getActivityGroupForIndex
Get a String that represents the Activity group for an index.- Parameters:
activityIndex
- a double between 0.0 and 5.0.- Returns:
- Name of the group (in English) that this activityIndex falls within.
-