Interface MetaserverClient
-
public interface MetaserverClientMeta 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 voidacknowledgeReport(String adminKey, String messageHash, Runnable onSuccess, Consumer<Exception> onError)Not open for public use, requires a keyvoidannounce(DirectoryRecord record, String officialKey, Runnable onSuccess, Consumer<Exception> onError)Announces a game session.voidannounceDedicated(DedicatedRecord record, String officialKey, Runnable onSuccess, Consumer<Exception> onError)Announces a dedicated server for match making.voidannounceMany(String report, String officialKey, Runnable onSuccess, Consumer<Exception> onError)Announces many game sessions at once.voiddiscontinue(DirectoryRecord record, Runnable onSuccess, Consumer<Exception> onError)Removes a game session from the game browser.voiddiscontinueDedicated(DedicatedRecord record, Runnable onSuccess, Consumer<Exception> onError)Removes a dedicated server for match making.voiddownloadShare(String hash, String code, BiConsumer<Long,Long> monitor, Consumer<byte[]> onSuccess, Consumer<Exception> onError)Downloads an object from share (e.g.voidgetDedicatedOfficial(Consumer<DedicatedRecord> onSuccess, Consumer<Exception> onError)Returns an official dedicated server.voidgetMyIp(Consumer<String> onSuccess, Consumer<Exception> onError)Returns the sender's IP addressvoidgetOps(String officialKey, String adminKey, UUID id, Consumer<Ops> onSuccess, Consumer<Exception> onError)Not open for public use, requires a keyvoidgetReports(String adminKey, boolean includeAck, Consumer<List<AdminErrorReport>> onSuccess, Consumer<Exception> onError)Not open for public use, requires a keyvoidgetStatistics(String adminKey, OffsetDateTime from, Consumer<List<Statistics>> onSuccess, Consumer<Exception> onError)Not open for public use, requires a keyStringgetUrl()voidlistDedicatedAll(Consumer<List<DedicatedRecord>> onSuccess, Consumer<Exception> onError)Lists all dedicated servers.voidlistSessionsAll(Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)Lists all game sessionsvoidlistSessionsByQuickJoinCode(String quickJoinCode, Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)Lists game sessions by certain criteriavoidlistSessionsLobby(Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)Lists game sessions by certain criteriavoidlistSessionsLobbyNoPassword(Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)Lists game sessions by certain criteriavoidlistSessionsNoPassword(Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)Lists game sessions by certain criteriavoidpostHighscore(HighScore highscore, String officialKey, Consumer<HighScore> onSuccess, Consumer<Exception> onError)Submits a highscorevoidpostOps(String officialKey, String adminKey, Ops ops, Runnable onSuccess, Consumer<Exception> onError)Not open for public use, requires a keyvoidqueryShare(String hash, String code, Consumer<String> onSuccess, Consumer<Exception> onError)Queries shared objects (e.g.voidreport(Report report, Runnable onSuccess, Consumer<Exception> onError)Sends an error report.voidreportStatistics(String officialKey, GameSessionStatisticRecord record, Runnable onSuccess, Consumer<Exception> onError)Not open for public use, requires a keyvoidsearchHighscores(List<UUID> ids, String gameMode, boolean official, String gameRunMode, String player, Consumer<List<HighScore>> onSuccess, Consumer<Exception> onError)Searches for highscoresvoidsearchSessions(boolean lobby, boolean password, String name, String gameMode, String mod, Consumer<List<DirectoryRecord>> onSuccess, Consumer<Exception> onError)Searches for game sessionsvoidshutdown()voidtestConnection(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.voiduploadShare(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)
-
-