使用 TypeScript / JavaScript 编写 Minecraft Paper 插件。
Yeow 是一个用于 Paper 服务器的插件运行时,让你能够使用现代前端工具链(TypeScript、npm、esbuild)来构建插件,而非 Java。每个插件都在其独立的 隔离 QuickJS 线程 中运行——它永远不会阻塞服务器主线程,且崩溃的插件不会影响其他插件。
特性
- TypeScript 优先 — 为命令参数、事件负载和 API 结果提供完整的类型推断
- 隔离线程 — 每个插件一个 QuickJS 上下文;插件代码绝不会阻塞游戏线程
- 三级优先级调度器(HIGH / NORMAL / LOW),带有时间片预算、自动降级和动态预算缩放
- 秒级热重载 — 编辑
src/,在服务器上实时查看效果,无需重启
- 声明式权限 — 敏感节点(
fs:*、http:*、service:registerNative、assets:extract)默认被拒绝,直到明确声明
- 平台无关的插件包 —
.yeow.zip 就是一个普通的 ZIP 文件,可在任何兼容的运行时上运行,而不仅限于 JVM/Bukkit
- 原生服务 — 将 Go / Rust / C++ 二进制文件嵌入你的插件中;运行时会根据平台提取并启动它们
- 运行时健康诊断 — 心跳 ping、事件/Tab 补全超时、队列积压和调度器饱和度警告
快速开始 —— 插件开发者
npm create yeow@latest -- -y --ts # 生成 TypeScript 插件脚手架
cd my-plugin
npm install
npm run dev # 启动 Paper + 热重载
npm run build # 生成 dist/<name>-<version>.jar + .yeow.zip
import { onLoad, registerCommand, Player, pdcGet, pdcSet, log } from 'yeow-api';
onLoad(() => {
registerCommand('back', {
description: '传送至你的死亡位置',
executor: async (p) => {
const player = await Player.get(p.sender.uuid);
if (player) await player.teleport(new Location(0, 64, 0, 0, 0, 'world'));
},
});
log.info('MyPlugin loaded');
});
快速开始 —— 服务器管理员
- 将此插件安装到
plugins/ 目录并重启服务器
- 将任何 Yeow 插件包(
.yeow.zip)放入 plugins/Yeow/ —— 启动时自动加载
- 或者在线安装:
/yeow install <url> — 下载并安装 .yeow.zip
/yeow update <url> — 替换旧版本(旧副本移至 plugins/Yeow/.backup/)
/yeow unload <plugin> / /yeow reload <plugin> — 管理正在运行的插件
/yeow profile / /yeow track <plugin> <seconds> — 性能诊断
要求
文档
- 中文文档:
- 包含入门指南、API 参考(24 个模块)、平台规范以及运行时警告指南。
许可证
MIT(运行时、API、工具链)。QuickJS 引擎(MIT)通过 quickjs-wrapper(Apache-2.0)进行捆绑。
Write Minecraft Paper plugins in TypeScript / JavaScript.
Yeow is a plugin runtime for Paper servers that lets you build plugins with
modern frontend tooling (TypeScript, npm, esbuild) instead of Java. Each
plugin runs in its own isolated QuickJS thread — it never blocks the
server main thread, and a crashing plugin doesn't affect other plugins.
Features
- TypeScript-first — full type inference for command args, event payloads and API results
- Isolated threads — one QuickJS context per plugin; plugin code never blocks the game thread
- Three-level priority scheduler (HIGH / NORMAL / LOW) with time-slice budgets, automatic demotion and dynamic budget scaling
- Hot reload in seconds — edit
src/, see it live on the server, no restart
- Declarative permissions — sensitive nodes (
fs:*, http:*, service:registerNative, assets:extract) are denied by default until declared
- Platform-agnostic plugin packages — a
.yeow.zip is a plain ZIP, runnable on any conforming runtime, not just JVM/Bukkit
- Native Service — embed Go / Rust / C++ binaries in your plugin; the runtime extracts and spawns them per platform
- Runtime health diagnostics — heartbeat pings, event / tab-completion timeouts, queue backlog and scheduler saturation warnings
Quick start — plugin developer
npm create yeow@latest -- -y --ts # scaffold a TypeScript plugin
cd my-plugin
npm install
npm run dev # starts Paper + hot reload
npm run build # dist/<name>-<version>.jar + .yeow.zip
import { onLoad, registerCommand, Player, pdcGet, pdcSet, log } from 'yeow-api';
onLoad(() => {
registerCommand('back', {
description: 'Teleport to your death location',
executor: async (p) => {
const player = await Player.get(p.sender.uuid);
if (player) await player.teleport(new Location(0, 64, 0, 0, 0, 'world'));
},
});
log.info('MyPlugin loaded');
});
Quick start — server admin
- Install this plugin into
plugins/ and restart the server
- Drop any Yeow plugin package (
.yeow.zip) into plugins/Yeow/ — auto-loaded on startup
- Or install on the fly:
/yeow install <url> — download + install a .yeow.zip
/yeow update <url> — replace an older version (old copy goes to plugins/Yeow/.backup/)
/yeow unload <plugin> / /yeow reload <plugin> — manage running plugins
/yeow profile / /yeow track <plugin> <seconds> — performance diagnostics
Requirements
Documentation
- 中文文档:
- Getting started, API reference (24 modules), platform specifications and
runtime-warning guide are all included.
License
MIT (runtime, API, tooling). The QuickJS engine (MIT) is bundled through
the quickjs-wrapper (Apache-2.0).
评论 0
登录后参与评分
还没有评论,来抢沙发吧