Open source · MIT

Minecraft plugins in TypeScript

PaperScript lets you author Paper/Spigot plugins in modern JavaScript and TypeScript — hot-reloaded, with a typed SDK and MiniMessage chat — and ships them as a normal .jar.

What it is

A Paper plugin that embeds the GraalJS engine. Drop a bundled JS/TS script into the scripts folder and it gets a clean API — commands, events, scheduler, players, worlds, locations and persistent storage. No Java required from your players.

Why PaperScript

TypeScript first

Typed @paperscript/sdk with autocompletion for the whole server API.

GraalJS runtime

Modern ECMAScript on the JVM — fast, sandboxed, main-thread safe.

Hot reload

Edit a script and reload without restarting the server.

MiniMessage chat

Rich, gradient, hoverable messages out of the box.

Persistent storage

Per-script JSON storage with automatic save on disable.

Multi-version

Paper 1.18–1.21 plus legacy 1.12.2 / 1.16.5 — both shipped in v0.2.

Hello, plugin

scripts/hello.ts
ps.onEnable(() => {
  ps.logger.info("hello.ts loaded");

  ps.commands.register("spawn", (ctx) => {
    if (!ctx.sender.player) {
      ctx.sender.sendMessage("<red>Players only.</red>");
      return;
    }
    const player = ps.players.get(ctx.sender.name);
    const world = player && ps.worlds.get(player.location.world);
    if (player && world) {
      player.teleport(world.spawnLocation);
      player.sendMessage("<green>✦ Teleported to spawn!</green>");
    }
  });

  ps.events.onPlayerJoin((event) => {
    ps.server.broadcast(
      "<gradient:#3b82f6:#93c5fd>☄ ${event.player.name} joined!</gradient>"
    );
  });
});

Install

  1. 1Download the right jar from Releases: paperscript-host (1.18–1.21) or paperscript-legacy (1.12.2 / 1.16.5).
  2. 2Drop it into your Paper server plugins/ folder and start once.
  3. 3Put your script in plugins/PaperScript/scripts/ and reload.

Version support

Modern (Paper)v0.2

1.18 · 1.19 · 1.20 · 1.21 — full GraalJS engine.

Legacyv0.2

1.12.2 · 1.16.5 — Nashorn engine, shipped in v0.2.

Build your next plugin in TypeScript