TypeScript and JavaScript quickstart

You'll install Rune onto a Paper server, scaffold a new script, write a join announcer, and reload it without restarting the server.

Prerequisites

For Python, follow the Python quickstart.

  • Paper 1.21.4 on Java 25.
  • The rune CLI on your PATH (curl -fsSL https://runemc.dev/install.sh | bash on macOS or Linux; irm https://runemc.dev/install.ps1 | iex on Windows).

1. Install Rune onto the server

Drop the Rune jar into plugins/ and start the server once. Rune creates plugins/Rune/scripts/ on first load and writes out bukkit.d.ts by reflecting the classpath you're actually running on.

cd your-paper-server
cp ~/Downloads/Rune-*.jar plugins/
java -Xmx2G -jar paper.jar nogui   # let it boot once, then stop

2. Scaffold a script

From inside the scripts directory, ask the CLI to scaffold a new Rune. It writes src/index.ts and a rune.tomldeclaring the entry point.

cd plugins/Rune/scripts
rune init hello
cd hello

3. Write a join announcer

Open src/index.ts. The scaffold gives you a working example; replace it with this:

@Listener
export class HelloListeners {
  @EventHandler(Events.PlayerJoinEvent)
  onJoin(e: PlayerJoinEvent) {
    const player = e.getPlayer();
    rune.adventure.broadcast(rune.mm("<gold>Welcome, <name>!", {
      name: player.getName(),
    }));
  }
}

Three things are happening here. @Listener tells the host to register every @EventHandler method on this class as a Bukkit listener. PlayerJoinEvent is a real Bukkit type — your IDE autocompletes against the classes that actually exist on this server, including any plugins you've declared. rune.mm creates the formatted component and rune.adventure.broadcast sends it to the server. The Adventure guide covers safe interpolation, titles, action bars, and sounds.

4. Reload

From the server console, run /rune reload. The host tears down its Node isolate, rebuilds it, replays your scripts, and re-registers their handlers. There's no need to stop and restart Paper.

5. Watch it run

Join the server. The first player to log in triggers your handler; the broadcast lands in everyone's chat. From here, the rest of the docs are a tour of features: commands, menus, persistence, and HTTP servers — all in the same process as the server.

Use JavaScript

For a plain JavaScript Rune, create a file named hello.js in plugins/Rune/scripts/. The Node.js runtime exposes the same Rune APIs to JavaScript. Reload from the server console.

rune.on("PlayerJoinEvent", ({ player }) => {
  rune.broadcast("Welcome, " + player.getName() + "!");
});