Back to darkpix.ruDARKPIX.RU
PaperScript
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
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>"
);
});
});