VelocityCommandForward
将命令从后端转发到代理!
✨ 功能
- 自定义命令。
- 自定义消息。
- 可自定义静默发送的命令(不发送消息或控制台日志)。
- 玩家和控制台均可执行代理命令(向代理发送数据包,以玩家或控制台身份执行)。
- 可选加密。命令使用共享的
secret.key 进行加密和验证,防止伪造或重放。
📥 如何安装?/ 安装 / 设置
非常简单,下载 Velocity 和 Paper 插件并将其上传到相应的服务器(代理/后端)。
- 关闭你的代理(Velocity)和后端(Paper)服务器。
- 下载对应版本的 Velocity 和 Paper 插件。
- 将两个插件文件(针对你的服务器版本)放入
plugins 文件夹中。
- 启动服务器。
- 如果使用加密,请执行以下步骤。
- 从代理服务器的
plugins/velocity-command-forward/secret.key 复制到每个后端服务器的 plugins/VelocityCommandForward/ 目录中。
- 在每个后端服务器上运行
/proxyexec reload(或重启服务器)。
💡 注意事项
- 加密由代理服务器单独控制,后端服务器会自动跟随配置。
- 要禁用加密,请在代理配置中设置
use-crypto-protection: false 或将 secret.key 留空。
- 服务器时间必须保持在彼此 30 秒以内,否则加密的命令将被拒绝。
❓ 此插件的用例是什么?
- 我的用例比较小众:我有一个 Discord 命令可以运行 Minecraft 命令(如果玩家在线),但问题是 Discord 机器人运行在后端服务器上,因此我决定制作一个插件来运行代理命令,例如
/skin。
- 另一个常见用例是当你在 Velocity 上安装 TAB 插件时,需要从后端服务器向代理服务器发送命令,例如
/btab scoreboard 以切换 TAB 记分板。虽然手动执行没问题,但如果你使用其他插件中的自定义物品绑定该命令,命令可能会执行失败。在这种情况下,仅依赖本插件的命令即可解决 TAB 命令无法工作的问题。
🕹️ 命令用法
命令名称可在后端插件配置中更改:
custom-command: proxyexec
| 命令 |
描述 |
权限 |
/proxyexec reload |
用于重新加载插件配置。更改 custom-command 需要重启服务器。 |
velocitycommandforward.admin (op) |
/proxyexec <command> |
将命令转发到代理。示例:/proxyexec tab reload 将在代理上执行 /tab reload。 |
velocitycommandforward.send |
在示例中我将命令改为了 proxy,我没有将其设为默认值,因为我担心其他插件可能已经使用了这个命令。
在控制台中执行
如果你在控制台中执行命令,你将不会得到任何输出,结果会显示在代理服务器的日志中。
必须至少有一名在线玩家才能向代理发送命令数据包(这是后端和代理之间插件消息通道的工作原理)。
后端服务器。
代理服务器。
📄 默认配置
后端 (Paper)
更改 custom-command 需要重启服务器。
# VelocityCommandForward
# 用于将命令转发到代理的命令。
# 你需要重启服务器才能使更改生效。
custom-command: proxyexec
# 在这里你可以指定根命令,这些命令不会发送日志和消息。
filtered-commands:
- example_command
# {command} = 发送者发送的命令
# {sender} = 发送命令的玩家
# 如果设置为 '',则不发送消息。
messages:
reload: '&a插件消息和过滤器已重新加载!'
command-sent-as-player: '&2命令以玩家身份发送到代理 &7=> &a/{command}'
command-sent-as-console: '&2命令以控制台身份发送到代理 &7=> &a/{command}'
no-online-player: '&c必须至少有 1 名在线玩家才能执行代理控制台命令!'
console-log: '[{sender}] 正在向代理发送命令数据包 => /{command}'
velocity-log: '[{sender}] 收到代理命令数据包 => /{command}'
secret-missing: '&c无法转发命令,代理要求加密。请检查服务器控制台!'
代理 (Velocity)
# 使用 secret.key(首次启动时创建)加密转发的命令。
# 将 secret.key 复制到每个后端服务器的 plugins/VelocityCommandForward/ 目录中。
use-crypto-protection: false
✅ 要求
- Velocity 插件基于
Java 17 构建,Paper 插件基于 Java 21。
- 兼容 1.20.6 及以上版本。由于插件使用 Brigadier(1.20.6 中添加)来构建命令,运行较低版本的服务器将会遇到错误。
VelocityCommandForward
Forward commands from backend to proxy!
✨ Features
- Custom command.
- Custom message.
- Customize commands to be sent silently (without sending messages or console logs).
- Players and console can execute proxy commands (sends a packet to the proxy to execute either as player or console).
- Optional encryption. Commands are encrypted and verified with a shared
secret.key, so they can't be forged or replayed.
📥 How to install? / Installation / Setup
Very simple, download both Velocity and Paper plugin and upload to their designed servers (proxy/backend).
- Turn off your proxy (Velocity) and backend (Paper) server.
- Download Velocity and Paper version plugin.
- Drop both plugin files (for your server version) into the
plugins folder.
- Start your server.
- If using encryption, do these steps.
- Copy
plugins/velocity-command-forward/secret.key from the proxy into plugins/VelocityCommandForward/ on every backend.
- Run
/proxyexec reload on each backend (or restart).
💡 Notes
- Encryption is controlled by the proxy only, backend servers follow it automatically.
- To disable encryption, set
use-crypto-protection: false in the proxy config or leave secret.key empty.
- Server clocks must be within 30 seconds of each other, or encrypted commands are rejected.
❓ Use case for this?
- My use case was very niche, I have a discord command that can run Minecraft commands (if player is online) and
the issue was that the discord bot was running on backend server, and so I decided to make a plugin to run proxy
commands, such as
/skin.
- Another common use case is when you install the TAB plugin on Velocity and need to send commands from the backend server to the proxy server, such as
/btab scoreboard to toggle TAB's scoreboard. While executing it manually works fine, if you use custom items from other plugins that are bound to this command, the command may fail to execute. In such cases, simply relying on this plugin's commands can resolve the issue of TAB commands not working.
🕹️ Command usage
Command name can be changed in the backend plugin configuration:
custom-command: proxyexec
| command |
description |
permission |
/proxyexec reload |
Used to reload plugin config. Changing custom-command requires a server restart. |
velocitycommandforward.admin (op) |
/proxyexec <command> |
Forward commands to the proxy. Example: /proxyexec tab reload executes /tab reload on the proxy. |
velocitycommandforward.send |
In the examples I changed the command to proxy, I didn't set it as default because I was worried that some other plugin could use this command already.
Executing in console
If you execute the command in the console, you won't get any output, and instead it's going to show up in the proxy server logs.
There must be at least one online player to be able to send command packet to the proxy (that's how plugin messaging channels work between backend and proxy).
Backend server.
Proxy server.
📄 Default configurations
Backend (Paper)
Changing custom-command requires a server restart.
# VelocityCommandForward
# Command for forwarding commands to proxy.
# You need to restart the server for the changes to apply.
custom-command: proxyexec
# Here you can specify root commands that will not send log and message.
filtered-commands:
- example_command
# {command} = The command that was sent by the sender
# {sender} = The player who sent the command
# If set to '', no message will be sent.
messages:
reload: '&aPlugin messages and filters have been reloaded!'
command-sent-as-player: '&2Command sent to proxy &7=> &a/{command}'
command-sent-as-console: '&2Command sent as console to proxy &7=> &a/{command}'
no-online-player: '&cThere must be at least 1 online player to be able to execute proxy console commands!'
console-log: '[{sender}] Sending command packet to proxy => /{command}'
velocity-log: '[{sender}] Received proxy command packet => /{command}'
secret-missing: '&cCannot forward commands, the proxy requires encryption. Please check the server console!'
Proxy (Velocity)
# Encrypt forwarded commands using secret.key (created on first start).
# Copy secret.key to plugins/VelocityCommandForward/ on every backend.
use-crypto-protection: false
✅ Requirements
- Velocity plugin was built with
Java 17 and Paper plugin is Java 21.
- Compatible with versions 1.20.6 and above. Since the plugin uses Brigadier (added in 1.20.6) to build commands, servers running lower versions will encounter errors.
评论 0
登录后参与评分
还没有评论,来抢沙发吧