Developers Writing a plugin
Menus in game
A plugin can give players a page in the /relay menu, with forms they fill in, as well as Discord commands.
Forms
Both BedrockRelay packs load @minecraft/server-ui, so your plugin can import ActionFormData, ModalFormData and MessageFormData from it like any addon. On a Realm it's the stable version, without Beta APIs.
The player has just typed in chat, so the first form may be cancelled with FormCancelationReason.UserBusy while the chat screen closes. Show it again a few ticks later:
import { system } from "@minecraft/server";
import { FormCancelationReason } from "@minecraft/server-ui";
async function show(form, player) {
for (let tries = 0; tries < 40; tries++) {
const response = await form.show(player);
if (response.cancelationReason !== FormCancelationReason.UserBusy) return response;
await new Promise((resolve) => system.runTimeout(resolve, 5));
}
return { canceled: true };
}
Versions
Menus need pack v0.10.0 on a dedicated server and Realm pack v1.5.0. Set minPackVersion (and minRealmPackVersion for Realms) so the dashboard asks for the update before installing your plugin. On an older pack there's no /relay in game, and the rest of your plugin works as before.
Running a Minecraft world rather than building for one? The help covers everything from setup to troubleshooting.
Read the help