Plugin Engine,Minecraft 的实时脚本 IDE
在浏览器中编写 JavaScript 或 Java 代码,并在正在运行的服务器上执行,无需重载、无需重启、无需配置。
只需将 JAR 文件放入 /plugins 目录,在聊天中输入 /plugin-engine,点击链接,即可开始编码。就是这么简单。
✨ 功能特性
? JavaScript,即时响应,无样板代码
使用内置脚本 API,通过一行代码注册 Bukkit 事件处理器:
on("playerJoin", (player) => {
player.sendMessage("§a欢迎, §e" + player.name + "§a!");
server.broadcast("§7[§a+§7] §a" + player.name + " 加入了服务器。");
});
on("playerChat", (player, msg) => {
if (msg.startsWith("!heal")) player.heal();
});
按下 Ctrl+Enter → 代码将在服务器上实时运行。无需类、无需导入、无需样板代码。
☕ Java,真实类,实时编译
使用服务器的 JDK 在运行时编译实际的 Java 类。支持 implements Listener、extends EngineScript,或任何包含 run(ScriptContext) 方法的类:
public class JoinScript extends EngineScript {
@Override
public void onEnable(ScriptContext ctx) {
ctx.listen(PlayerJoinEvent.class, e ->
e.getPlayer().sendMessage("§a欢迎!"));
ctx.scheduleRepeating(() -> ctx.log("Tick!"), 20L, 20L);
}
@Override public void onDisable() {}
}
需要服务器上安装 JDK(不仅仅是 JRE)。
? 零配置,开箱即用
Plugin Engine 会自动连接到托管在 gianhosting.tech 的云后端。无需 API 密钥、无需共享密钥、无需设置反向代理。
- 安装 JAR → 启动服务器 → 输入
/plugin-engine → 获取链接 → 开始编码。
- 插件会在首次启动时生成唯一的服务器 ID 并自动连接。
- 想要自建后端?Node.js 后端 是开源的。
? 安全的会话链接
- 会话与您的 Minecraft 账号 绑定,身份无法被伪造。
- 每个链接都是单次使用的个性化令牌,有效期为 60 分钟(可配置)。
- 所有会话路由都在每次请求时通过会话验证进行保护。
- 所有会话页面均配备安全头(CSP、X-Frame-Options、Referrer-Policy、Permissions-Policy)。
? 社区脚本市场
在社区内分享您的脚本,并发现由他人制作的脚本,直接来自 IDE 内部。
- 上传者身份经过验证:通过 Minecraft 会话验证,玩家名称从经过身份验证的 Minecraft 会话中提取,而非用户输入。无法伪造。
- 每个脚本都会显示警告,提示在执行前应审查社区代码。
- 按 JS / Java 过滤,按名称、作者或描述搜索。
- 您自己的脚本会显示删除按钮。
? 脚本在会话结束后及重启后继续运行
脚本在您会话结束后继续运行,它们不依赖于浏览器标签页。
- 使用
/plugin-engine stop 显式停止所有脚本(仅限管理员)。
- 在 IDE 中将任何脚本标记为 自动启动:它将被保存到磁盘,并在每次服务器启动时自动重新执行,无需进一步操作。
- 自动启动条目存储在
plugins/PluginEngine/startup.json 中。
? 脚本存储
在 IDE 内部保存和加载您的脚本。存储方式可以是:
- 全局(
global-storage: true,默认),服务器上的所有玩家共享一个脚本库。
- 按玩家(
global-storage: false),每个玩家拥有自己的 scripts/{name}/ 文件夹。
? 快速入门
1. 安装
将 PluginEngine-1.0.0.jar 放入服务器的 /plugins 文件夹并重启。
2. 打开 IDE
在 Minecraft 聊天中输入:
/plugin-engine
聊天中会出现一个可点击的链接。点击它以打开浏览器中的 IDE。
3. 编写与执行
选择 JavaScript 或 Java,编写代码,按下 Ctrl+Enter。
一切就绪。无需配置。
⚙️ 配置 (config.yml)
| 选项 |
默认值 |
描述 |
port |
5000 |
内置 Web 服务器的端口(若无后端则作为回退) |
max-sessions |
5 |
同时打开的最大会话数 |
session-duration-minutes |
60 |
会话链接的有效时长(分钟) |
global-storage |
true |
true = 共享脚本文件夹,false = 按玩家文件夹 |
backend-url |
wss://gianhosting.tech/plugin-wss |
后端的 WebSocket URL |
public-url |
https://gianhosting.tech |
会话链接中使用的公共 URL |
server-id |
(自动生成) |
此服务器的唯一标识符,请勿手动编辑 |
您无需更改任何内容,一切均已设置完毕。
? 权限
| 权限 |
默认值 |
描述 |
pluginengine.use |
op |
打开会话并使用 IDE |
pluginengine.admin |
op |
访问 /plugin-engine stop 和 revoke all |
?️ 命令
| 命令 |
描述 |
/plugin-engine |
打开新会话并获取链接 |
/plugin-engine revoke |
结束您自己的会话(脚本继续运行) |
/plugin-engine stop |
停止所有正在运行的脚本 [管理员] |
/plugin-engine status |
显示活动会话、脚本数量、后端状态 |
/plugin-engine help |
显示所有可用命令 |
别名:/pe, /peng
? 要求
- Paper 1.21 或更高版本(Spigot 未官方支持)
- Java 21 或更高版本
- JDK(不仅仅是 JRE),用于 Java 编译。JavaScript 无需 JDK 即可工作。
? JavaScript API 参考
// 事件处理器
const id = on("eventName", callback) // 注册
off(id) // 注销
// 事件
"playerJoin" // (player)
"playerQuit" // (player)
"playerDeath" // (player)
"playerRespawn" // (player)
"playerMove" // (player)
"playerInteract" // (player)
"playerChat" // (player, msg)
"blockBreak" // (player, block)
"blockPlace" // (player, block)
// 玩家
player.name player.health player.gameMode
player.sendMessage("§aText")
player.kick("reason")
player.teleport(x, y, z)
player.giveItem("DIAMOND", 1)
player.heal()
player.setGameMode("creative")
// 服务器
server.broadcast("§6Text")
server.runCommand("say hello")
server.getOnlinePlayers()
server.getTPS()
// 日志记录
log("message")
❓ 常见问题解答
在没有网络的情况下是否可用?
是的。如果云端后端无法连接,插件会回退到配置的 port 上的内置 Web 服务器。你也可以在 config.yml 中将 backend-url 设置为空,以始终使用本地服务器。
脚本在重载后是否会保留?
内存中的脚本会在执行 /reload 或重启时丢失。请使用 IDE 中的 自动启动 功能,以便在每次服务器启动时自动重新执行脚本。
玩家能否利用此插件进行破坏(griefing)?
pluginengine.use 权限默认分配给 op(管理员)。请仅授予受信任的玩家该权限。脚本以完整的服务器权限运行,请将其视为插件对待。
为什么 Java 编译需要 JDK?
用于运行时编译的 javax.tools.JavaCompiler API 仅在 JDK 中可用,而普通的 JRE 不包含该 API。大多数服务器托管提供商都提供了 JDK;如果你的提供商没有提供,JavaScript 仍然可以在没有 JDK 的情况下正常工作。
云端后端是否安全?
服务器使用其自动生成的 UUID server-id(存储在 config.yml 中)向后端进行身份验证。此 ID 充当 128 位随机密钥。请勿分享你的 config.yml。
基于 Mozilla Rhino 构建 JavaScript 支持 · Ace Editor · Fastify 后端通过 Cloudflare Tunnel 在树莓派上运行
Plugin Engine, Live Scripting IDE for Minecraft
Write JavaScript or Java in your browser and execute it on your running server, no reload, no restart, no config.
Just drop the JAR into /plugins, type /plugin-engine in chat, click the link, and start coding. That's it.
✨ Features
? JavaScript, Instant & No Boilerplate
Register Bukkit event handlers with a single line using the built-in scripting API:
on("playerJoin", (player) => {
player.sendMessage("§aWelcome, §e" + player.name + "§a!");
server.broadcast("§7[§a+§7] §a" + player.name + " joined.");
});
on("playerChat", (player, msg) => {
if (msg.startsWith("!heal")) player.heal();
});
Press Ctrl+Enter → runs live on the server. No classes, no imports, no boilerplate.
☕ Java, Real Classes, Live Compiled
Compile actual Java classes at runtime using the server's JDK. Supports implements Listener, extends EngineScript, or any class with a run(ScriptContext) method:
public class JoinScript extends EngineScript {
@Override
public void onEnable(ScriptContext ctx) {
ctx.listen(PlayerJoinEvent.class, e ->
e.getPlayer().sendMessage("§aWelcome!"));
ctx.scheduleRepeating(() -> ctx.log("Tick!"), 20L, 20L);
}
@Override public void onDisable() {}
}
Requires JDK (not just JRE) on the server.
? Zero Config, Works Out of the Box
Plugin Engine automatically connects to the hosted cloud backend at gianhosting.tech. No API keys, no shared secrets, no reverse proxy setup required.
- Install JAR → start server → type
/plugin-engine → get a link → code.
- The plugin generates a unique server ID on first start and connects automatically.
- Want to self-host the backend? The Node.js backend is open source.
? Secure Session Links
- Sessions are tied to your Minecraft account, identity cannot be spoofed.
- Each link is a one-time personalized token, valid for 60 minutes (configurable).
- All session routes are protected by session validation on every request.
- Security headers (CSP, X-Frame-Options, Referrer-Policy, Permissions-Policy) on all session pages.
? Community Script Marketplace
Share your scripts with the community and discover scripts made by others, directly from within the IDE.
- Uploader identity is verified through the Minecraft session: the player name is pulled from the authenticated Minecraft session, not user input. It cannot be faked.
- Every script shows a warning that community code should be reviewed before execution.
- Filter by JS / Java, search by name, author, or description.
- Your own scripts show a delete button.
? Scripts Survive Sessions & Restarts
Scripts keep running after your session ends, they are not tied to the browser tab.
- Use
/plugin-engine stop to explicitly stop all scripts (admin-only).
- Mark any script as Auto-Start in the IDE: it will be saved to disk and re-executed automatically every time the server starts, with no further action required.
- Auto-Start entries are stored in
plugins/PluginEngine/startup.json.
? Script Storage
Save and load your scripts from within the IDE. Storage can be:
- Global (
global-storage: true, default), all players on the server share one script library.
- Per-player (
global-storage: false), each player gets their own scripts/{name}/ folder.
? Getting Started
1. Install
Drop PluginEngine-1.0.0.jar into your server's /plugins folder and restart.
2. Open the IDE
In Minecraft chat, type:
/plugin-engine
A clickable link appears in chat. Click it to open the browser IDE.
3. Write & Execute
Select JavaScript or Java, write your code, press Ctrl+Enter.
That's everything. No configuration required.
⚙️ Configuration (config.yml)
| Option |
Default |
Description |
port |
5000 |
Port for the built-in web server (fallback if no backend) |
max-sessions |
5 |
Maximum number of simultaneous open sessions |
session-duration-minutes |
60 |
How long a session link stays valid |
global-storage |
true |
true = shared script folder, false = per-player folders |
backend-url |
wss://gianhosting.tech/plugin-wss |
WebSocket URL of the backend |
public-url |
https://gianhosting.tech |
Public URL used in session links |
server-id |
(auto-generated) |
Unique identifier for this server, do not edit manually |
You don't have to change anything, everything is already setup.
? Permissions
| Permission |
Default |
Description |
pluginengine.use |
op |
Open a session and use the IDE |
pluginengine.admin |
op |
Access to /plugin-engine stop and revoke all |
?️ Commands
| Command |
Description |
/plugin-engine |
Open a new session and receive a link |
/plugin-engine revoke |
End your own sessions (scripts keep running) |
/plugin-engine stop |
Stop all running scripts [Admin] |
/plugin-engine status |
Show active sessions, script count, backend status |
/plugin-engine help |
Show all available commands |
Aliases: /pe, /peng
? Requirements
- Paper 1.21 or higher (Spigot is not officially supported)
- Java 21 or higher
- JDK (not just JRE), required for Java compilation. JavaScript works without JDK.
? JavaScript API Reference
// Event handler
const id = on("eventName", callback) // register
off(id) // unregister
// Events
"playerJoin" // (player)
"playerQuit" // (player)
"playerDeath" // (player)
"playerRespawn" // (player)
"playerMove" // (player)
"playerInteract" // (player)
"playerChat" // (player, msg)
"blockBreak" // (player, block)
"blockPlace" // (player, block)
// Player
player.name player.health player.gameMode
player.sendMessage("§aText")
player.kick("reason")
player.teleport(x, y, z)
player.giveItem("DIAMOND", 1)
player.heal()
player.setGameMode("creative")
// Server
server.broadcast("§6Text")
server.runCommand("say hello")
server.getOnlinePlayers()
server.getTPS()
// Logging
log("message")
❓ FAQ
Does this work without internet?
Yes. If the cloud backend is unreachable, the plugin falls back to the built-in web server on the configured port. You can also set backend-url to blank in config.yml to always use the local server.
Are scripts persisted across reloads?
Scripts in memory are lost on /reload or restart. Use the Auto-Start feature in the IDE to re-execute scripts automatically on every server start.
Can players grief with this?
The pluginengine.use permission defaults to op. Only grant it to trusted players. Scripts run with full server permissions, treat them like plugins.
Why does Java compilation require JDK?
The javax.tools.JavaCompiler API used for runtime compilation is only available in a JDK, not a plain JRE. Most server hosting providers include a JDK; if yours doesn't, JavaScript still works without it.
Is the cloud backend safe?
The server authenticates to the backend using its auto-generated UUID server-id (stored in config.yml). This ID acts as a 128-bit random secret. Don't share your config.yml.
Built with Mozilla Rhino for JavaScript · Ace Editor · Fastify backend on Raspberry Pi via Cloudflare Tunnel
评论 0
登录后参与评分
还没有评论,来抢沙发吧