- Compatible API Versions
- 1.0.0
ServerSettingsApi
Production-grade packet-level API for Bedrock Server Settings on Nukkit.
Core Flow
The API delivers a stable integration contract for plugin teams that need predictable behavior, typed parsing, and runtime observability.
Value Proposition
Architecture
Compatibility
Installation
1. Deploy provider plugin
Build this project and place the JAR into your server
directory.
2. Add dependency in consumer plugin
3. Resolve service
Quick Start
Advanced Response Orchestration
Dynamic Payload by Player Context
Observability
Production Guidelines
Public API Surface
Build
Production-grade packet-level API for Bedrock Server Settings on Nukkit.
Core Flow
Code:
PlayerServerSettingsRequestEvent -> ServerSettingsResponsePacket -> ModalFormResponsePacket -> response routing
Value Proposition
- Packet-first architecture with no abstraction leaks into non-packet form systems.
- Strong ownership model (
) for multi-plugin server environments.Code:
owner + key - Multiple response styles: handler, processor, parsed processor, or pipeline.
- Built-in runtime metrics for operations, incident analysis, and capacity tracking.
- Automatic lifecycle cleanup on player quit and plugin disable.
Architecture
Code:
Consumer Plugin(s)
-> ServerSettingsApi (service contract)
-> PacketServerSettingsApi (engine)
-> listens: PlayerServerSettingsRequestEvent
-> sends: ServerSettingsResponsePacket
-> listens: DataPacketReceiveEvent (ModalFormResponsePacket)
-> routes response to registered definition
-> exports metrics via ServerSettingsApiStats
- Java: 17
- Nukkit API: 1.0.0
- Plugin Name:
Code:
NovaServerSettingsApi - Maven Compiler:
Code:
--release 17
Installation
1. Deploy provider plugin
Build this project and place the JAR into your server
Code:
plugins/
2. Add dependency in consumer plugin
YAML:
depend: [NovaServerSettingsApi]
Java:
import org.nova.api.ServerSettingsApi;
import org.nova.api.ServerSettingsApiLocator;
ServerSettingsApi api = ServerSettingsApiLocator.require(getServer());
Java:
import cn.nukkit.plugin.PluginBase;
import org.nova.api.ServerSettingsApi;
import org.nova.api.ServerSettingsApiLocator;
import org.nova.api.ServerSettingsDefinition;
import org.nova.api.ServerSettingsJson;
import org.nova.api.ServerSettingsRegistration;
public final class ExamplePlugin extends PluginBase {
private ServerSettingsRegistration registration;
@Override
public void onEnable() {
ServerSettingsApi api = ServerSettingsApiLocator.require(getServer());
this.registration = api.register(
ServerSettingsDefinition.builder(this, "global-settings")
.payloadProvider(ctx -> ServerSettingsJson.customForm("Global Settings")
.label("Configure runtime behavior")
.toggle("Feature enabled", true)
.slider("Rate", 0, 100, 1, 25)
.input("Tag", "e.g. PROD", "")
.build())
.parsedResponseHandler((ctx, values) -> {
boolean featureEnabled = values.getBoolean(1, false);
int rate = values.getInt(2, 0);
String tag = values.getString(3, "");
getLogger().info(
"Settings updated: player=" + ctx.getPlayer().getName()
+ ", featureEnabled=" + featureEnabled
+ ", rate=" + rate
+ ", tag=" + tag
);
})
.acceptClosedResponses(false)
.build()
);
}
@Override
public void onDisable() {
if (this.registration != null) {
this.registration.unregister();
this.registration = null;
}
}
}
Java:
import org.nova.api.ServerSettingsResponsePipeline;
import org.nova.api.ServerSettingsResponses;
ServerSettingsResponsePipeline pipeline = ServerSettingsResponsePipeline.builder()
.thenParsed((ctx, values) -> {
boolean enabled = values.getBoolean(0, false);
int threshold = values.getInt(1, 50);
// 1) validate and map
})
.then(ctx -> {
// 2) persist, publish domain events, audit
})
.onError(ServerSettingsResponses.loggingErrors(this, "[ServerSettings] "))
.continueOnError(false)
.build();
api.register(
ServerSettingsDefinition.builder(this, "policy-settings")
.payloadProvider(ctx -> ServerSettingsJson.customForm("Policy")
.toggle("Enabled", true)
.slider("Threshold", 0, 100, 1, 50)
.build())
.responsePipeline(pipeline)
.build()
);
Java:
api.register(
ServerSettingsDefinition.builder(this, "personalized-settings")
.payloadProvider(ctx -> ServerSettingsJson.customForm("Hello " + ctx.getPlayer().getName())
.label("FormId: " + ctx.getFormId())
.toggle("Receive notifications", true)
.build())
.responseHandler(ctx -> {
boolean enabled = ctx.booleanAt(1, true);
// apply player-scoped configuration
})
.build()
);
Java:
var stats = api.getStats();
getLogger().info(
"serverSettingsApi"
+ " registrations=" + stats.getRegistrations()
+ " requestEvents=" + stats.getRequestEvents()
+ " packetsSent=" + stats.getPacketsSent()
+ " responsePackets=" + stats.getResponsePackets()
+ " processed=" + stats.getResponsesProcessed()
+ " failed=" + stats.getResponsesFailed()
+ " ignored=" + stats.getResponsesIgnored()
);
- Keep handlers deterministic and fast inside the event context.
- Offload heavy CPU or I/O to your own async scheduler.
- Return to main thread only for server-critical operations.
- Use stable keys (
) as long-term integration identifiers.Code:
owner + key - Prefer parsed handlers for strict type handling and explicit defaults.
- Track
andCode:
responsesFailedmetrics for early anomaly detection.Code:responsesIgnored
Public API Surface
-
: service contract used by consumer plugins.Code:
ServerSettingsApi -
: service resolution helper.Code:
ServerSettingsApiLocator -
: immutable registration definition + builder.Code:
ServerSettingsDefinition -
: registration handle with explicit unregister.Code:
ServerSettingsRegistration -
: payload creation context.Code:
ServerSettingsRequestContext -
: response metadata + lazy parsed access.Code:
ServerSettingsResponseContext -
: typed value accessor (Code:
ServerSettingsResponseValues).Code:boolean/int/double/string -
: composable multi-step response processing.Code:
ServerSettingsResponsePipeline -
: adapters and logging error handler factory.Code:
ServerSettingsResponses -
: runtime metrics snapshot.Code:
ServerSettingsApiStats
Build
Bash:
mvn clean package