The real API, not a wrapper
A Minekube game calls Paper’s own objects: server.getPlayer(...), event.setCancelled(true), player.sendActionBar(...). There is no Minekube API for players, blocks or menus in between. The contract is the server’s API itself, typed from the server’s jars.
What we tried first
Section titled “What we tried first”The first version translated every Paper call into its own JSON: an OpenAPI contract, one HTTP call per action, a converter per Java type. Every new type and every new feature then needed new code on the JVM, written by us. A game could not cancel an event in the tick it happened, and it could not implement a Java interface. An earlier client test driver built the same way grew hand-written bindings for every Minecraft version and every capability.
A contract layer over the real API forces feature code into the layer. So there is none.
What replaced it
Section titled “What replaced it”- Games call the API directly. The runtime hosts the game in GraalJS inside the server, so a call is a call, in the same tick, on the same objects.
- Types come from the jars. A generator reads every public class of Paper, Adventure, Brigadier and JOML by reflection, and nullability from the bytecode’s annotations. You get Paper’s names, overloads, nullability and
@deprecatedmarks, andJava.type("org.bukkit.Particle$DustOptions")is typed. The generator runs in the runtime when the server starts, on that server’s own jars, andmk dev .copies the result into your project. No package ships these types: they carry names from code we do not own, and they always match the server you run. - What Java obliges you to handle is in the types. A method that declares checked exceptions, or hands you something to close, cannot be called directly; only
Jvm.attemptandJvm.acquireget through, as Effects. See TypeScript and Effect. - The generator writes data, not logic. Schemas for Java values (a
java.util.UUIDas a checked, branded string, every enum as a union of its constants, every registry type such asSoundorBiomeas its key) and a table of conversions. The code that converts values at the boundary is ordinary, typed SDK code that reads the table.
One platform, one version
Section titled “One platform, one version”Paper code gets Paper’s types and Velocity code gets Velocity’s, each generated from that platform’s jars. There is no common layer across platforms: a Minestom game would get Minestom’s types. Reuse between platforms is a choice you make in TypeScript, not something we put between you and the server. See Platforms.
The types are also those of one version. The Paper runtime is one jar for Paper 1.21 and newer: it is built against the oldest supported API and runs unchanged on newer servers. What changes with the version is only the types, so each project uses the types of the server it targets.
What this buys
Section titled “What this buys”- No feature needs JVM code. A new game, event, menu, command or world feature changes nothing in the runtime. If something cannot be done through the server’s API from TypeScript, that is a gap in the runtime, closed once for every game.
- Same-tick control. A handler runs inside Paper’s own dispatch, so it can cancel or change the event before Paper continues.
- Java interfaces from JS. A JS function goes where Java expects a
Runnable, aConsumeror a BrigadierCommand. - Server updates cost nothing. A new Paper build brings new types, generated from its jars. Nothing in between has to follow.
- Agents read the types like any library. Your coding agent searches
paper.d.tsthe way it searches any dependency, and the strict check tells it when it guessed wrong.
What it costs
Section titled “What it costs”- A game sees the server’s whole public JVM, like a plugin does. That is right for your own code on your own server. Running other people’s games safely needs an allowlist per installation, resource limits and separate contexts; that is planned, as permissions rather than code generation.
- Some parameter names are missing. Paper’s API jar has none, so they read
arg0,arg1. They can come from the sources jar. - Games are tied to their platform. A Paper game does not run on Velocity. That is the point: each platform keeps its full API.
Was this helpful?
Thanks for the feedback.