Package dev.getelements.elements.sdk.dao
Interface MultiMatchDao
- All Known Implementing Classes:
MongoMultiMatchDao
public interface MultiMatchDao
Handles multi-matches, allowing multiple players to join or leave a match.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionaddProfile(String multiMatchId, Profile profile) Adds a newProfileto theMultiMatch.closeMatch(String multiMatchId) Flags theMultiMatchas closed, disallowing players to join.createMultiMatch(MultiMatch multiMatch) Creates a newMultiMatchwith no players.createMultiMatch(MultiMatch multiMatch, UniqueCodeDao.GenerationParameters joinCodeGenerationParameters) Creates a newMultiMatchwith no players.voidDeletes all of theMultiMatchinstances.default voiddeleteMultiMatch(String multiMatchId) Deletes theMultiMatchwith the given ID, throwing an exception if it does not exist.Flags theMultiMatchas ended, disallowing players to join.findMultiMatch(String multiMatchId) Finds aMultiMatchby its ID.findMultiMatchByJoinCode(String joinCode) Finds aMultiMatchby its ID.findOldestAvailableMultiMatchCandidate(MatchmakingApplicationConfiguration configuration, String profileId, String query) Finds the latestMultiMatchfor the given configuration and profile ID.default List<MultiMatch> Gets allMultiMatchinstances.getAllMultiMatches(String query) Gets allMultiMatchinstances.default MultiMatchgetMultiMatch(String multiMatchId) Gets aMultiMatchby its ID.default MultiMatchgetMultiMatchByJoinCode(String joinCode) Gets aMultiMatchby its ID.default Pagination<MultiMatch> getMultiMatches(int offset, int count) Fetches a paginated subset ofMultiMatchinstances.getMultiMatches(int offset, int count, String search) Fetches a paginated subset ofMultiMatchinstances matching the search.getProfiles(String multiMatchId) Gets allProfileinstances in theMultiMatch.Flags theMultiMatchas open, allowing players to join.refreshMatch(String multiMatchId) Refreshes theMultiMatch, resetting its expiry timer.removeProfile(String multiMatchId, Profile profile) Removes theProfileto theMultiMatch.booleantryDeleteMultiMatch(String multiMatchId) Deletes theMultiMatchwith the given ID, returning true if it was deleted, false if it did not exist.updateMultiMatch(String matchId, MultiMatch configuration) Creates a newMultiMatchwith no players.
-
Field Details
-
MULTI_MATCH_CREATED
- See Also:
-
MULTI_MATCH_ADD_PROFILE
- See Also:
-
MULTI_MATCH_REMOVE_PROFILE
- See Also:
-
MULTI_MATCH_UPDATED
- See Also:
-
MULTI_MATCH_EXPIRED
- See Also:
-
MULTI_MATCH_DELETED
- See Also:
-
MULTI_MATCHES_TRUNCATED
- See Also:
-
-
Method Details
-
getAllMultiMatches
Gets allMultiMatchinstances.- Returns:
- a
ListofMultiMatchinstances
-
getAllMultiMatches
Gets allMultiMatchinstances.- Parameters:
query- the query to execute- Returns:
- a
ListofMultiMatchinstances
-
getMultiMatches
Fetches a paginated subset ofMultiMatchinstances matching the search.- Parameters:
offset- - Pagination offsetcount- - Maximum objects in resultssearch- - Search query to filter results- Returns:
- Pagination of
MultiMatch
-
getMultiMatches
Fetches a paginated subset ofMultiMatchinstances.- Parameters:
offset- - Pagination offsetcount- - Maximum objects in results- Returns:
- Pagination of
MultiMatch
-
findMultiMatch
Finds aMultiMatchby its ID.- Parameters:
multiMatchId- the ID of the multi-match to find.- Returns:
- the found
MultiMatch, or an empty Optional if not found.
-
findMultiMatchByJoinCode
Finds aMultiMatchby its ID.- Parameters:
joinCode- the join code of the multi match.- Returns:
- the found
MultiMatch, or an empty Optional if not found.
-
findOldestAvailableMultiMatchCandidate
Optional<MultiMatch> findOldestAvailableMultiMatchCandidate(MatchmakingApplicationConfiguration configuration, String profileId, String query) Finds the latestMultiMatchfor the given configuration and profile ID. This method will exclude any matches that the specific profile currently not participating in. If no match meets the criteria, then an empty optional is returned allowing downstream code to create a new match. Additionally, a query can be provided to further filter the matches that are considered. The query is appended to the supplied criteria.- Parameters:
configuration- the matchmaking configurationprofileId- the profile ID to find the latest match forquery- the query to execute when searching for a match- Returns:
- the found
MultiMatch, or an empty Optional if not found.
-
getMultiMatch
Gets aMultiMatchby its ID.- Parameters:
multiMatchId- theMultiMatch's id- Returns:
- the
MultiMatch
-
getMultiMatchByJoinCode
Gets aMultiMatchby its ID.- Parameters:
joinCode- theMultiMatch's join code- Returns:
- the
MultiMatch
-
getProfiles
Gets allProfileinstances in theMultiMatch.- Parameters:
multiMatchId- tbe multi-match id to get profiles from- Returns:
- the
ListofProfileinstances in theMultiMatch - Throws:
MultiMatchNotFoundException- if noMultiMatchwith the given ID exists
-
addProfile
Adds a newProfileto theMultiMatch. Automatically sets the match status toMultiMatchStatus.FULLif the match reaches capacity.- Parameters:
multiMatchId- the multi-match id receiving the profileprofile- the profile to add- Returns:
- the updated
MultiMatch
-
removeProfile
Removes theProfileto theMultiMatch. Automatically sets the match status toMultiMatchStatus.OPENif the match was previously full and notMultiMatchStatus.CLOSED.- Parameters:
multiMatchId- the multi-match id receiving the profileprofile- the profile to add- Returns:
- the updated
MultiMatch
-
createMultiMatch
Creates a newMultiMatchwith no players.- Parameters:
multiMatch- theMultiMatchto create- Returns:
- the newly created
MultiMatch
-
createMultiMatch
MultiMatch createMultiMatch(MultiMatch multiMatch, UniqueCodeDao.GenerationParameters joinCodeGenerationParameters) Creates a newMultiMatchwith no players.- Parameters:
multiMatch- theMultiMatchto createjoinCodeGenerationParameters- theUniqueCodeDao.GenerationParametersto use when generating the join code- Returns:
- the newly created
MultiMatch
-
updateMultiMatch
Creates a newMultiMatchwith no players.- Parameters:
configuration- theMatchmakingApplicationConfigurationto use- Returns:
- the newly created
MultiMatch
-
openMatch
Flags theMultiMatchas open, allowing players to join. If the match is currently full, then this operation will set the match asMultiMatchStatus.FULL, otherwise it will set the match toMultiMatchStatus.OPEN.- Parameters:
multiMatchId- theMultiMatch- Returns:
- the updated
MultiMatch
-
closeMatch
Flags theMultiMatchas closed, disallowing players to join. This operation will set the match asMultiMatchStatus.CLOSED. Fails if the match isMultiMatchStatus.ENDED.- Parameters:
multiMatchId- the multi-match id to refresh- Returns:
- the updated
MultiMatch
-
endMatch
Flags theMultiMatchas ended, disallowing players to join. This operation will set the match asMultiMatchStatus.ENDED. Fails if the match is alreadyMultiMatchStatus.ENDED.- Parameters:
multiMatchId- the multi-match id to refresh- Returns:
- the updated
MultiMatch
-
refreshMatch
Refreshes theMultiMatch, resetting its expiry timer.- Parameters:
multiMatchId- the multi-match id to refresh- Returns:
- the updated
MultiMatch
-
deleteAllMultiMatches
void deleteAllMultiMatches()Deletes all of theMultiMatchinstances. -
deleteMultiMatch
Deletes theMultiMatchwith the given ID, throwing an exception if it does not exist. -
tryDeleteMultiMatch
Deletes theMultiMatchwith the given ID, returning true if it was deleted, false if it did not exist.
-