This repository was archived by the owner on Jul 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Server API
TheKodeToad edited this page Jan 7, 2023
·
2 revisions
🛈 This is a new feature in the unreleased version 1.9.0. This is also work-in-progress and subject to change.
Sol Client currently uses the plugin message channel sol-client:v1. To register it in a Bukkit plugin:
public static final String SOL_CLIENT_API = "sol-client:v1";
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, SOL_CLIENT_API);
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, SOL_CLIENT_API, (channel, player, message) -> {}); // CraftBukkit doesn't seem to behave well without thisMessages have this layout:
{
"action": "the_action",
"inputs": {"the": "arguments"}
}A packet on channel "REGISTER" will be sent with our channel ID if the server sends a register packet containing it. Here is how to detect it in Bukkit:
@EventHandler
public void onChannelRegistration(PlayerRegisterChannelEvent event) {
if (event.getChannel().equals(SOL_CLIENT_API))
// the world is your oyster yet again!
}This would be a good time to block mods!
{
"action": "block_mods",
"inputs": {
"mods": {
"block_me": true,
"dont_block_me": false
}
}
}