Important
This project is a prototype and is not production ready yet
EcmaCraft is a polyglot Minecraft plugin platform that lets you author Spigot plugin logic in TypeScript, while running through a Java host plugin powered by GraalVM JavaScript.
The repository is a monorepo that contains:
- a Java plugin runtime (
ecmacraft/) loaded by Spigot/Paper, - TypeScript packages for decorators and generated Spigot typings,
- a development plugin bundle (
packages/dev-plugin) that is executed inside the Java runtime, - a documentation site (
apps/www) built with Next.js.
Traditional plugin development is Java-first. EcmaCraft provides a TypeScript-first workflow with:
- Type-safe event signatures generated from Spigot API,
- decorator-based handler registration (
@Event,@Command), - Java host/plugin compatibility with standard Spigot deployment.
This simple plugin strikes lightning at the player's location whenever they start sneaking:
import { PluginContext, Event, SpigotEventType } from '@ecmacraft/types';
class LightningStriker {
@Event('PlayerToggleSneakEvent')
public onPlayerToggleSneak(event: SpigotEventType<'PlayerToggleSneakEvent'>) {
if (!event.isSneaking()) return;
const player = event.getPlayer();
const location = player.getLocation();
location.getWorld().strikeLightning(location);
}
}
export default function main(ctx: PluginContext) {
ctx.registerHandlers(new LightningStriker());
}- The Java plugin (
ecmacraft) starts on server boot. - It creates a GraalVM JS context and loads
plugins/ecmacraft/main.js. - The JS module default export receives a
PluginContext. - TypeScript handlers are registered via
ctx.registerHandlers(...). - Decorator metadata maps JS methods to Spigot events/commands.
ecmacraft/— Java plugin host (Maven project, shaded jar)packages/types/— runtime decorators and generated Spigot TypeScript definitionspackages/dev-plugin/— example/development TypeScript plugin bundleapps/www/— project docs site (Next.js + Fumadocs)scripts/— generation and server prep scriptstest-server/— local Minecraft server environment for integration testing
- Node.js
>= 18 pnpm(workspace package manager)- Java
21 - A Spigot/Paper-compatible test server jar in
test-server/
Install dependencies:
pnpm installBuild all workspace packages/apps:
pnpm buildBuild the Java host plugin jar:
pnpm build:pluginBuild generated TypeScript runtime/types (if needed after API updates):
pnpm --filter @ecmacraft/types buildBuild the development plugin bundle:
pnpm --filter @ecmacraft/dev-plugin buildpnpm test-servertest-server runs a pre-start copy step (scripts/pre-server.ts) that:
- copies the Java plugin jar to
test-server/plugins/ecmacraft.jar, - copies the TypeScript bundle to
test-server/plugins/ecmacraft/main.js.
This gives a tight edit → build → run loop for plugin iteration.
From repository root:
pnpm build— runturbobuild pipelinepnpm dev— run development tasks across workspacepnpm lint— lint workspace packages/appspnpm check-types— run type checkspnpm format— format TS/TSX/MD filespnpm build:plugin— package Java plugin via Mavenpnpm test-server— prepare and launch local server
Spigot typings can be regenerated from a server API jar:
pnpm generate-dtsThis updates generated files in packages/types/src and extracts event names for decorator typing.
The docs app is located in apps/www.
Start it from the root with your workspace dev pipeline, or run the app directly via filter:
pnpm --filter www devMIT — see LICENSE.