File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -351,6 +351,31 @@ server.addHeapSubscriber(new HeapSubscriber() {
351351});
352352```
353353
354+ #### Management Protocol
355+ The Minecraft server management protocol introduced in 1.21.9 allows controlling various server settings without
356+ restarting the server and receiving events from the server. This API client supports proxying this protocol through the
357+ exaroton websocket connection. All parameters/responses are JSON elements. There are no predefined classes for the data.
358+
359+ ``` jshelllanguage
360+ ExarotonClient client = new ExarotonClient("example-api-token");
361+
362+ Server server = client.getServer("tgkm731xO7GiHt76");
363+
364+ // Perform a request
365+ server.sendServerManagementRequest(
366+ "minecraft:operators/remove",
367+ JsonParser.parseString("[[{\"name\":\"" + playerName + "\"}]]")
368+ )
369+
370+ // Subscribe to notifications
371+ server.addServerManagementNotificationSubscriber(new ManagementNotificationSubscriber() {
372+ @Override
373+ public void handleNotification(@NotNull String name, @Nullable JsonElement data) {
374+ System.out.println("Received event: " + event);
375+ }
376+ });
377+ ```
378+
354379#### Unsubscribe
355380When all subscribers for a stream are removed, this library automatically unsubscribes from events for that stream. Once
356381all streams are closed the websocket connection is closed as well.
You can’t perform that action at this time.
0 commit comments