be35d92b52
- Updated response descriptors in various endpoints to utilize specific resource classes instead of generic JsonResponse. - Changed response types for friendship, guild, party, and support issue endpoints to their respective resource classes. - Incremented version number in manifest.json to 0.5.3 for the new changes.
2.7 KiB
2.7 KiB
Control Plane Client
ControlPlaneClient is the main public entry point for plugins.
ControlPlaneClient client = NetworkPlugin.client();
Public Clients
client.server(); // ServerClient
client.presence(); // PresenceClient
client.players(); // PlayersClient
client.batch(); // BatchClient
client.cache(); // ApiDataCacheClient
client.reactivePlayerCache(); // ReactivePlayerCacheHooks
Handwritten Domain Clients
ServerClient
ServerProfile profile = client.server().currentProfile();
PresenceClient
client.presence().register(instanceId, registrationPayload);
client.presence().heartbeat(instanceId, HeartbeatPayload.running(12, 150));
client.presence().shutdown(instanceId, "restart");
PlayersClient
PlayerSessionProfile profile = client.players().sessionProfile(playerId);
List<PlayerEntitlement> entitlements = client.players().entitlementsIndex(playerId);
AssetsClient
AssetPackVersion active = client.assets().getActivePack(packKey);
List<AssetPackVersionFile> files = client.assets().getPackVersionFiles(active.id());
Reactive Player Cache
reactivePlayerCache() is intended for Hytale ECS/event handlers that know player state changed and need cache freshness now, not after a TTL expires.
PlayerCacheContext context = new PlayerCacheContext(playerId, playerRef, entityStore);
client.reactivePlayerCache().onPlayerJoin(context);
client.reactivePlayerCache().onPermissionChanged(context);
client.reactivePlayerCache().onSanctionChanged(context);
client.reactivePlayerCache().onNotificationCreated(context);
These hooks invalidate and prewarm the player-scoped cache entries for permission snapshots, moderation sanction snapshots, and notifications.
Error Handling
Transport errors use checked ControlPlaneException subclasses:
AuthExceptionfor401and403NotFoundExceptionfor404ValidationExceptionfor422RemoteExceptionfor5xxControlPlaneExceptionfor other transport or parsing failures
Example:
try {
ServerProfile profile = client.server().currentProfile();
} catch (AuthException e) {
// token is missing, invalid, inactive, or lacks ability
} catch (ControlPlaneException e) {
// generic control-plane failure
}
Endpoint Descriptors
Generated endpoint descriptors are available under:
net.kewwbec.network.generated.api.v1
Use them for stable route metadata and URI templates. Resolve path variables with PathBuilder.
String uri = PathBuilder.resolve(
SessionProfileEndpoint.VALUE.uri(),
"player",
playerId
);
Do not edit generated descriptors manually. Update routes in core-control-plane, then run the SDK sync command from that repo.