RocketMC 0.9.0 beta: Java and Bedrock, one binary. See what's new

RocketMC is in beta (0.9.0). These docs follow the source code; if something differs on your build, the code wins. Please report it on GitHub.

Plugin API

API Overview

How WebAssembly plugins plug into the server.

Updated Dec 5, 2026

RocketMC plugins are WebAssembly components. They talk to the server through a versioned WIT interface (rocketmc:plugin) inside a wasmtime sandbox. Any language that targets the component model works, and Rust is first-class through the rocketmc-plugin-api crate.

New to this? Start with Your first plugin.

Core concepts

  • Plugin: your entry point, with new, metadata, on_load and on_unload.
  • Context: given to on_load; gives you the server, your data folder and event registration.
  • Server: players, worlds, managers (ops, bans, whitelist, recipes, enchantments, datapacks) and runtime info such as TPS.
  • World: blocks, entities, time, weather, sounds, particles and chunks.
  • Events: typed notifications that handlers can observe, change or cancel.
  • Permissions: every sensitive capability must be requested in the plugin metadata and approved by the server.
  • Helpers: pure-Rust modules on top of the API, imported with rocketmc_plugin_api::prelude::*.

Lifecycle

load  ->  new  ->  on_load  ->  events / commands / tasks  ->  on_unload  ->  unload
CallbackPurpose
new()Construct the plugin state
metadata()Name, version, authors, dependencies and requested permissions
on_load(Context)Register handlers, schedule tasks, read config
on_unload(Context)Save data, cancel tasks
pub trait Plugin: Send + Sync {
    fn new() -> Self where Self: Sized;
    fn metadata(&self) -> PluginMetadata;
    fn on_load(&self, context: Context) -> Result<()> { Ok(()) }
    fn on_unload(&self, context: Context) -> Result<()> { Ok(()) }
}

A plugin whose API version does not match the server is rejected with Plugin API version mismatch. Rebuild it against the server's API.

Context

MethodDescription
get_server()The Server resource
get_data_folder()Your private data folder (needs fs.read.data / fs.write.data)
get_marketplace_metadata()Signature and marketplace information, if present
register_event_handler(handler, priority, blocking)Subscribe with a handler type
listen::<E, _>(closure) / on::<E, _>(priority, closure)Subscribe with a closure
log(msg)Write to the server log

Server

  • Players: get_player_count, get_all_players, get_player_by_name, get_player_by_uuid, broadcast.
  • Worlds: get_all_worlds, get_world_by_name, create_world, unload_world, save_all.
  • Management: op_manager, ban_manager, whitelist_manager, recipe_manager, enchantment_manager, datapack_manager, get_advancement.
  • Runtime info: get_sys_info, get_tps, get_mspt, get_difficulty, get_max_players, get_motd, is_hardcore, is_online_mode.
  • Execution: execute_command(command, sender) with a console or player sender, plus tab list header and footer and server links.

RocketMC additions

These methods exist in both API worlds:

MethodDescription
set_difficulty(difficulty)Same behaviour as /difficulty; hardcore servers stay hard
set_difficulty_locked(locked) / is_difficulty_locked()Lock, unlock and query the difficulty
shutdown()Graceful stop that saves worlds, like /stop. Returns immediately
get_minecraft_version()The supported Java version string
use rocketmc_plugin_api::wit::rocketmc::plugin::server::Difficulty;

let server = ctx.get_server();
server.set_difficulty(Difficulty::Hard);
server.set_difficulty_by_name("hard")?; // from ServerExt, config friendly

World

The World resource covers blocks (get_block_state, set_block_state, break_block, set_block_by_name), queries (get_top_block_y, get_biome, light levels, ray tracing), entities (spawn_entity, get_entities_in_box, drop_item, strike_lightning), ambience (time, weather, sounds, particles, create_explosion), state (spawn, game rules, block entity NBT, namespaced custom data, chunks, save) and world generation through the worldgen::ChunkGenerator trait.

Permissions

PermissionAllows
network.dnsDNS lookups
network.tcp, network.udpSockets, with finer connect and bind variants
network.loopbackConnecting back to the server itself
http.outboundOutbound HTTP
fs.read.data, fs.write.dataYour plugin's private data folder
sys.env, sys.env.<PREFIX>Environment variables
sys.info (+ .cpu, .ram, .os)System information fields
IPC and marketplace permissionsPlugin messaging and license checks

Use the constants in rocketmc_plugin_api::permissions rather than typing the strings.

Saving data

There is no separate storage API. Request fs.read.data and fs.write.data, get the folder from context.get_data_folder(), and read and write normal files. The storage helpers wrap the common cases.

Other subsystems

Display entities, server-side GUIs and Bedrock forms, Java dialogs, scoreboards, boss bars, teams, statistics, custom mobs and AI, enchantments, recipes, datapacks, IPC messaging and gametests all have their own resources. Each Wasm plugin runs in its own instance, so statics are not shared between plugins.

Versioning

The WIT package is rocketmc:plugin. The Rust crate targets 0.1.0; 0.2.0 mirrors the same surface and gets new features first. Breaking changes need a new world version, and additive changes land in the newest world. The server rejects plugins built for a different API version.

The full reference is docs/API.md in the repository.