Use the Java SDK
Compile your integration with Java 21 or the version required by your Paper target. Add the SDK as compileOnly and depend on PixonixServerAPI in plugin.yml. The server plugin supplies the SDK at runtime; do not bundle a second copy.
dependencies {
compileOnly files('libs/pixonix-server-sdk-1.0.0.jar')
compileOnly 'io.papermc.paper:paper-api:1.21.11-R0.1-SNAPSHOT'
}depend: [PixonixServerAPI]Example plugin
package eu.pixonix.example;
import eu.pixonix.api.*;
import java.util.List;
import java.util.Set;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
/** Example code: may be adapted for free integrations under the Developer License. */
public final class ExamplePlugin extends JavaPlugin implements Listener {
private PixonixApi api;
@Override public void onEnable() {
api = getServer().getServicesManager().load(PixonixApi.class);
if (api == null) throw new IllegalStateException("PixonixServerAPI is required");
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler public void ready(PixonixReadyEvent event) {
api.setSettings(event.getPlayer(), new ClientSettings(
new ServerRules(Set.of("health_indicator"), false),
List.of(QuickJoin.proxy("Lobby", "lobby"), QuickJoin.proxy("Survival", "survival"))));
}
}The example replaces the current player’s policy with a health-indicator restriction and two proxy destinations. Adapt these routes before using it. To extend existing defaults, read api.settings(player), construct a new ClientSettings and keep the values you want to preserve.
| API | Purpose |
|---|---|
| supportsPixonix(player) | Reports registration of the protocol channel. |
| settings(player) | Returns the immutable effective SDK/default settings. |
| setSettings(player, settings) | Replaces settings for an online player. Coalesces sends within a tick. |
| resetSettings(player) | Removes the override and sends the configured defaults. |
| PixonixReadyEvent | Fires on channel registration, including registration after a server switch. |
Thread and lifecycle
Call the API only on the server thread. Schedule asynchronous results back onto that thread. Settings are held in memory and removed when the player leaves. If your integration is enabled after players connected, also iterate online players and check supportsPixonix; the ready event is not replayed.