Interface MetaserverClient
-
public interface MetaserverClient
Meta Server Client
This is an API client to connect to the metaserver. Note that the client is async and all callbacks will be executed in a separate IO thread. Implement onSuccess and onError callbacks respectively. In the context of these IO threads engine and server facades must be accessed with context check disabled and there are limitations to access classes from scripts. Therefore it is advised to just fire an event or dispatch a message and execute any major operation in the event- or message handler.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
acknowledgeReport(String adminKey, String messageHash, Runnable onSuccess, Consumer<Exception> onError)
Not open for public use, requires a keyvoid
announce(DirectoryRecord record, String officialKey, Runnable onSuccess, Consumer<Exception> onError)
Announces a game session.void
announceDedicated(DedicatedRecord record, String officialKey, Runnable onSuccess, Consumer<Exception> onError)
Announces a dedicated server for match making.void
announceMany(String report, String officialKey, Runnable onSuccess, Consumer<Exception> onError)
Announces many game sessions at once.void
discontinue(DirectoryRecord record, Runnable onSuccess, Consumer<Exception> onError)
Removes a game session from the game browser.void
discontinueDedicated(DedicatedRecord record, Runnable onSuccess, Consumer<Exception> onError)
Removes a dedicated server for match making.void
downloadShare(String hash, String code, BiConsumer<Long,Long> monitor, Consumer<byte[]> onSuccess, Consumer<Exception> onError)
Downloads an object from share (e.g.void
getDedicatedOfficial(Consumer<DedicatedRecord> onSuccess, Consumer<Exception> onError)
Returns an official dedicated server.void
getMyIp(Consumer<String> onSuccess, Consumer<Exception> onError)
Returns the sender's IP addressvoid
getOps(String officialKey, String adminKey, UUID id, Consumer<Ops> onSuccess, Consumer<Exception> onError)
Not open for public use, requires a keyvoid
getReports(String adminKey, boolean includeAck, Consumer<List<AdminErrorReport>> onSuccess, Consumer<Exception> onError)
Not open for public use, requires a keyvoid
getStatistics(String adminKey, OffsetDateTime from, Consumer<List<Statistics>> onSuccess, Consumer<Exception> onError)
Not open for public use, requires a keyString
getUrl()
void
listDedicatedAll(Consumer<List<DedicatedRecord>> onSuccess, Consumer<Exception> onError)
Lists all dedicated servers.void
listSessionsAll(Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)
Lists all game sessionsvoid
listSessionsByQuickJoinCode(String quickJoinCode, Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)
Lists game sessions by certain criteriavoid
listSessionsLobby(Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)
Lists game sessions by certain criteriavoid
listSessionsLobbyNoPassword(Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)
Lists game sessions by certain criteriavoid
listSessionsNoPassword(Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)
Lists game sessions by certain criteriavoid
postHighscore(HighScore highscore, String officialKey, Consumer<HighScore> onSuccess, Consumer<Exception> onError)
Submits a highscorevoid
postOps(String officialKey, String adminKey, Ops ops, Runnable onSuccess, Consumer<Exception> onError)
Not open for public use, requires a keyvoid
queryShare(String hash, String code, Consumer<String> onSuccess, Consumer<Exception> onError)
Queries shared objects (e.g.void
report(Report report, Runnable onSuccess, Consumer<Exception> onError)
Sends an error report.void
reportStatistics(String officialKey, GameSessionStatisticRecord record, Runnable onSuccess, Consumer<Exception> onError)
Not open for public use, requires a keyvoid
searchHighscores(List<UUID> ids, String gameMode, boolean official, String gameRunMode, String player, Consumer<List<HighScore>> onSuccess, Consumer<Exception> onError)
Searches for highscoresvoid
searchSessions(boolean lobby, boolean password, String name, String gameMode, String mod, Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)
Searches for game sessionsvoid
shutdown()
void
testConnection(Runnable onSuccess, Consumer<Exception> onError)
Metaserver will try to open a server connection to the sender's IP address to check whether the game server is reachable (e.g.void
uploadShare(Object payload, BiConsumer<Long,Long> monitor, Consumer<String> onSuccess, Consumer<Exception> onError)
Shares an object (e.g.
-
-
-
Method Detail
-
shutdown
@RestrictedMethod void shutdown()
-
getUrl
String getUrl()
-
listSessionsAll
void listSessionsAll(Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)
Lists all game sessions
-
listSessionsLobby
void listSessionsLobby(Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)
Lists game sessions by certain criteria
-
listSessionsNoPassword
void listSessionsNoPassword(Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)
Lists game sessions by certain criteria
-
listSessionsLobbyNoPassword
void listSessionsLobbyNoPassword(Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)
Lists game sessions by certain criteria
-
listSessionsByQuickJoinCode
void listSessionsByQuickJoinCode(String quickJoinCode, Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)
Lists game sessions by certain criteria
-
searchSessions
void searchSessions(boolean lobby, boolean password, String name, String gameMode, String mod, Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)
Searches for game sessions
-
announce
void announce(DirectoryRecord record, String officialKey, Runnable onSuccess, Consumer<Exception> onError)
Announces a game session. Must be renewed in certain intervals. DirectoryRecord#secret is required to renew an entry, just set the same secret as for the initial announcement. A valid officialKey is optional but required to announce game sessions that are flagged as official.
-
announceMany
void announceMany(String report, String officialKey, Runnable onSuccess, Consumer<Exception> onError)
Announces many game sessions at once. See also #announce
-
discontinue
void discontinue(DirectoryRecord record, Runnable onSuccess, Consumer<Exception> onError)
Removes a game session from the game browser. DirectoryRecord#secret is required, just set the same secret as for the initial announcement.
-
testConnection
void testConnection(Runnable onSuccess, Consumer<Exception> onError)
Metaserver will try to open a server connection to the sender's IP address to check whether the game server is reachable (e.g. in the router) and accepts connections
-
getMyIp
void getMyIp(Consumer<String> onSuccess, Consumer<Exception> onError)
Returns the sender's IP address
-
report
void report(Report report, Runnable onSuccess, Consumer<Exception> onError)
Sends an error report.
-
getReports
void getReports(String adminKey, boolean includeAck, Consumer<List<AdminErrorReport>> onSuccess, Consumer<Exception> onError)
Not open for public use, requires a key
-
acknowledgeReport
void acknowledgeReport(String adminKey, String messageHash, Runnable onSuccess, Consumer<Exception> onError)
Not open for public use, requires a key
-
announceDedicated
void announceDedicated(DedicatedRecord record, String officialKey, Runnable onSuccess, Consumer<Exception> onError)
Announces a dedicated server for match making. Must be renewed in certain intervals, secret must match for renewing. A valid officialKey is optional but required to announce game sessions that are flagged as official.
-
discontinueDedicated
void discontinueDedicated(DedicatedRecord record, Runnable onSuccess, Consumer<Exception> onError)
Removes a dedicated server for match making. Secret must match.
-
listDedicatedAll
void listDedicatedAll(Consumer<List<DedicatedRecord>> onSuccess, Consumer<Exception> onError)
Lists all dedicated servers.
-
getDedicatedOfficial
void getDedicatedOfficial(Consumer<DedicatedRecord> onSuccess, Consumer<Exception> onError)
Returns an official dedicated server.
-
getStatistics
void getStatistics(String adminKey, OffsetDateTime from, Consumer<List<Statistics>> onSuccess, Consumer<Exception> onError)
Not open for public use, requires a key
-
reportStatistics
void reportStatistics(String officialKey, GameSessionStatisticRecord record, Runnable onSuccess, Consumer<Exception> onError)
Not open for public use, requires a key
-
postOps
void postOps(String officialKey, String adminKey, Ops ops, Runnable onSuccess, Consumer<Exception> onError)
Not open for public use, requires a key
-
getOps
void getOps(String officialKey, String adminKey, UUID id, Consumer<Ops> onSuccess, Consumer<Exception> onError)
Not open for public use, requires a key
-
postHighscore
void postHighscore(HighScore highscore, String officialKey, Consumer<HighScore> onSuccess, Consumer<Exception> onError)
Submits a highscore
-
searchHighscores
void searchHighscores(List<UUID> ids, String gameMode, boolean official, String gameRunMode, String player, Consumer<List<HighScore>> onSuccess, Consumer<Exception> onError)
Searches for highscores
-
queryShare
void queryShare(String hash, String code, Consumer<String> onSuccess, Consumer<Exception> onError)
Queries shared objects (e.g. ships, scenes)- Parameters:
hash
- Optional, hash of object to download (You have to provide either hash or code)code
- Optional, download code to download (You have to provide either hash or code)monitor
- Optional, callback to receive download progress. First argument is the current size in bytes, second is the toal size (can be 0 because of chunked transfers)
-
uploadShare
void uploadShare(Object payload, BiConsumer<Long,Long> monitor, Consumer<String> onSuccess, Consumer<Exception> onError)
Shares an object (e.g. ships, scenes) Only these classes can be uploaded: de.extio.spacecraft.shared.model.bo.Scene, de.extio.spacecraft.shared.model.message.toboth.CompositeEntityDefinitionMessage- Parameters:
monitor
- Optional, callback to receive upload progress. First argument is the current size in bytes, second is the toal size (can be 0)onSuccess
- Callback payload is the download code
-
downloadShare
void downloadShare(String hash, String code, BiConsumer<Long,Long> monitor, Consumer<byte[]> onSuccess, Consumer<Exception> onError)
Downloads an object from share (e.g. ships, scenes) Deserialize with ObjectSerialization#deserialize(bytes, false, true, true, null, null, null) from engine or server facade.
Be aware that the onSuccess callback (as all callbacks) will be executed in an IO thread and the serializer will only use the default class loader in that context. If you need to deserialize classes from scripts you need to dispatch the data first to your client engine or server game session instance thread.- Parameters:
hash
- Optional, hash of object to download (You have to provide either hash or code)code
- Optional, download code to download (You have to provide either hash or code)monitor
- Optional, callback to receive download progress. First argument is the current size in bytes, second is the toal size (can be 0 because of chunked transfers)
-
-