Proxied Command
GitHub - Hangar - Modrinth - SpigotMC - Discord
本项目是 Proxied Warp 的分支。
Proxied Command 允许玩家在 Velocity 或 BungeeCord 网络中的跨服务器执行命令。玩家无需手动切换服务器——Proxied Command 会自动将其连接到目标服务器,然后在该服务器上执行命令。
该项目包含四个模块:
| 模块 |
功能 |
velocity |
在后端服务器之间转发命令请求,并在需要时将玩家连接到目标服务器 |
paper |
接收玩家的 /proxiedcommand 命令,并在服务器连接完成后执行所请求的命令。适用于 Paper 后端服务器。支持使用 MiniMessage 格式的消息样式 |
spigot |
与 paper 模块功能相同,但适用于 Spigot 后端服务器。消息使用传统的 Minecraft 颜色代码(&)而非 MiniMessage |
bungeecord |
BungeeCord 代理模块,负责转发命令请求并将玩家连接到目标服务器 |
工作原理
代理服务器与后端服务器之间的通信通过共享的 插件消息通道 proxied_command:command 和 proxied_command:message 进行。
工作流程如下:
- 玩家执行命令 – 在后端服务器上,玩家调用注册的命令并指定目标服务器和要执行的命令(例如
/proxiedcommand farmworld home farmhome)。
- 后端插件发送消息 – 插件(根据服务器类型选择
paper 或 spigot 模块)首先检查输入内容和权限,然后构建消息 <player> <server> <command> 并通过通道以插件消息的形式发送给代理服务器。
- 代理插件处理请求(Velocity 或 BungeeCord):
- 检查指定的玩家和目标服务器是否存在。
- 如果玩家已经在目标服务器上,则直接转发消息。
- 否则,先建立到目标服务器的连接,仅在服务器切换成功后才转发消息。
- 目标服务器执行命令 – 目标服务器上的插件接收转发的消息,检查玩家是否在该服务器上在线,并以该玩家的身份调度给定的命令。
安装
- 将对应的代理模块放入代理服务器的
plugins 文件夹中:velocity 用于 Velocity,bungeecord 用于 BungeeCord。
- 在每个希望玩家能够触发或接收命令的后端服务器上安装对应的后端模块:在 Paper 服务器上安装
paper 模块,在 Spigot 服务器上安装 spigot 模块。
- 重启代理服务器和相关后端服务器。
配置(Paper/Spigot 模块)
首次启动时,相应的插件会生成一个包含以下默认值的 config.yml。aliases 部分是可选的,可以手动添加。
paper 模块:
need-permission: false
whitelisted-servers: []
whitelisted-commands: []
message:
usage: '<red>用法:</red> /proxiedcommand <server> <command>'
usage-other: '<red>用法:</red> /proxiedcommandother <player> <server> <command>'
permission: '<red>你没有权限执行此操作!</red>'
server-not-whitelisted: '<red>此服务器未在白名单中!</red>'
command-not-whitelisted: '<red>此命令未在白名单中!</red>'
player-not-online: '<red>玩家不在线!</red>'
key-not-found: "<red>未找到键 '<key>'!"
server-not-found: '<red>未找到服务器!'
connection-failed: '<red>连接失败!'
spigot 模块:
need-permission: false
whitelisted-servers: []
whitelisted-commands: []
message:
usage: '&c用法:&r /proxiedcommand <server> <command>'
usage-other: '&c用法:&r /proxiedcommandother <player> <server> <command>'
permission: '&c你没有权限执行此操作!'
server-not-whitelisted: '&c此服务器未在白名单中!'
command-not-whitelisted: '&c此命令未在白名单中!'
player-not-online: '&c玩家不在线!'
key-not-found: "&c未找到键 &f'%s' &c!"
server-not-found: '&c未找到服务器!'
connection-failed: '&c连接失败!'
| Key |
Description |
need-permission |
决定玩家是否需要显式权限才能使用命令(参见 Permissions)。 |
whitelisted-servers |
允许作为目标的服务器列表。如果为空,则允许所有服务器。 |
whitelisted-commands |
允许执行的命令列表。如果为空,则允许所有命令。 |
aliases |
可选部分,用于将别名映射到目标服务器。例如,spawn: lobby 可使 /proxiedcommand spawn 在 lobby 上执行 spawn。 |
message.usage |
当 /proxiedcommand 使用不正确时显示的消息。 |
message.permission |
缺少权限时显示的消息。 |
message.server-not-whitelisted |
当服务器未被列入白名单时显示的消息。 |
message.command-not-whitelisted |
当命令未被列入白名单时显示的消息。 |
message.usage-other |
当 /proxiedcommandother 使用不正确时显示的消息。 |
message.player-not-online |
当所选玩家在源服务器上未在线时显示的消息。 |
message.key-not-found |
当配置的消息键缺失时使用的备用消息。 |
message.server-not-found |
当代理无法找到目标服务器时显示的消息。 |
message.connection-failed |
当代理无法将玩家连接到目标服务器时显示的消息。 |
在 paper 模块中,消息支持 MiniMessage 格式(例如 <red>、<bold>)。在 spigot 模块中,消息则使用传统的 Minecraft 颜色代码,以 & 作为格式化字符(例如 &c 表示红色)。
命令
以下命令在后端服务器(Paper 或 Spigot)上可用:
/proxiedcommand <server> <command>
/proxiedcommandother <player> <server> <command>
这些命令还有别名:/proxied_command 和 /pcmd 对应 /proxiedcommand,以及 /proxied_command_other、/pcmdother 和 /pcmdo 对应 /proxiedcommandother。
<server> – 目标服务器的名称,即在代理配置(例如 velocity.toml)中注册的名称。
<command> – 要在目标服务器上执行的命令。参数可能包含空格。
<alias> – 在 config.yml 中定义的别名,用于将别名/命令名称映射到目标服务器。
<player> – 应被连接并执行命令的在线玩家。
/proxiedcommand 只能由玩家执行。/proxiedcommandother 也可以从控制台执行。
权限
如果在 config.yml 中将 need-permission 设置为 true,玩家需要拥有以下任一权限才能执行 /proxiedcommand <server> <command>:
| Permission |
Effect |
proxiedcommand.command.* |
允许执行所有命令。 |
proxiedcommand.command.<command> |
允许执行特定命令(空格替换为下划线)。 |
对于 /proxiedcommandother,相应的权限是 proxiedcommand.command.other.* 和 proxiedcommand.command.other.<command>。
权限通过前缀进行匹配,因此无需指定完整的命令。例如,当 need-permission: true 时:
proxiedcommand.command.gamemode 允许 gamemode creative 和 gamemode survival。
proxiedcommand.command.gamemode_creative 允许 gamemode creative,但不允许 gamemode survival。
在构建权限时,命令中的空格会被替换为下划线。相同的前缀行为也适用于相应的 proxiedcommandother 权限。
如果两者都缺少权限,玩家将收到在 message.permission 中配置的错误消息,并且请求不会发送到代理。
如果 need-permission 设置为 false(默认值),则不执行权限检查,每个玩家都可以为每个已注册的服务器使用该命令。
要求
- 具有相应代理模块(
velocity 或 bungeecord)的 Velocity 或 BungeeCord 代理。
- 基于 Paper 的后端服务器(带有
paper 模块)或基于 Spigot 的后端服务器(带有 spigot 模块)。
- 要执行的命令必须在目标后端服务器上可用。
- Java 版本 25 或更高版本。
已知限制
- Proxied Command 本身不会检查指定的命令是否存在——命令验证和执行由目标服务器处理。
Proxied Command
GitHub - Hangar - Modrinth - SpigotMC - Discord
This project is a fork of Proxied Warp.
Proxied Command allows players to execute commands across servers within a Velocity or BungeeCord network. The player doesn't need to manually switch servers – Proxied Command automatically connects them to the target server and then executes the command there.
The project consists of four modules:
| Module |
Task |
velocity |
Forwards command requests between backend servers and connects players to the target server when needed |
paper |
Receives the /proxiedcommand command from the player and executes the requested command after the server connection. For Paper backend servers. Supports MiniMessage formatting for messages |
spigot |
Same functionality as the paper module, but for Spigot backend servers. Messages use legacy Minecraft color codes (&) instead of MiniMessage |
bungeecord |
BungeeCord proxy module that forwards command requests and connects players to the target server |
How It Works
Communication between the proxy and backend servers happens via the shared Plugin Messaging Channels proxied_command:command and proxied_command:message.
The process works as follows:
- Player executes command – On a backend server, the player calls the registered command with a target server and command (e.g.,
/proxiedcommand farmworld home farmhome).
- Backend plugin sends message – The plugin (
paper or spigot module, depending on the server) first checks the input and permission, then builds the message <player> <server> <command> and sends it as a plugin message over the channel to the proxy.
- Proxy plugin processes the request (Velocity or BungeeCord):
- Checks whether the specified player and target server exist.
- If the player is already on the target server, the message is forwarded directly.
- Otherwise, a connection to the target server is established first, and the message is only forwarded after the server switch succeeds.
- Target server executes the command – The plugin on the target server receives the forwarded message, checks whether the player is online there, and dispatches the given command as that player.
Installation
- Place the matching proxy module in the proxy's
plugins folder: velocity for Velocity or bungeecord for BungeeCord.
- Install the matching backend module on every backend server where players should be able to trigger or receive commands: the
paper module on Paper servers, the spigot module on Spigot servers.
- Restart the proxy and the affected backend servers.
Configuration (Paper/Spigot Modules)
On first startup, the respective plugin generates a config.yml with the following default values. The aliases section is optional and can be added manually.
paper module:
need-permission: false
whitelisted-servers: []
whitelisted-commands: []
message:
usage: '<red>Usage:</red> /proxiedcommand <server> <command>'
usage-other: '<red>Usage:</red> /proxiedcommandother <player> <server> <command>'
permission: '<red>You do not have permission to do that!</red>'
server-not-whitelisted: '<red>This server is not whitelisted!</red>'
command-not-whitelisted: '<red>This command is not whitelisted!</red>'
player-not-online: '<red>Player is not online!</red>'
key-not-found: "<red>Key '<key>' not found!"
server-not-found: '<red>Server not found!'
connection-failed: '<red>Connection failed!'
spigot module:
need-permission: false
whitelisted-servers: []
whitelisted-commands: []
message:
usage: '&cUsage:&r /proxiedcommand <server> <command>'
usage-other: '&cUsage:&r /proxiedcommandother <player> <server> <command>'
permission: '&cYou do not have permission to do that!'
server-not-whitelisted: '&cThis server is not whitelisted!'
command-not-whitelisted: '&cThis command is not whitelisted!'
player-not-online: '&cPlayer is not online!'
key-not-found: "&cKey &f'%s' &cnot found!"
server-not-found: '&cServer not found!'
connection-failed: '&cConnection failed!'
| Key |
Description |
need-permission |
Determines whether players need an explicit permission to use the commands (see Permissions). |
whitelisted-servers |
List of servers that are allowed to be used as a target. If empty, all servers are allowed. |
whitelisted-commands |
List of commands that are allowed to be executed. If empty, all commands are allowed. |
aliases |
Optional section mapping an alias to a target server. For example, spawn: lobby lets /proxiedcommand spawn execute spawn on lobby. |
message.usage |
Message shown when /proxiedcommand is used incorrectly. |
message.permission |
Message shown when permission is missing. |
message.server-not-whitelisted |
Message shown when a server is not whitelisted. |
message.command-not-whitelisted |
Message shown when a command is not whitelisted. |
message.usage-other |
Message shown when /proxiedcommandother is used incorrectly. |
message.player-not-online |
Message shown when the selected player is not online on the source server. |
message.key-not-found |
Fallback message used when a configured message key is missing. |
message.server-not-found |
Message shown when the target server cannot be found by the proxy. |
message.connection-failed |
Message shown when the proxy cannot connect the player to the target server. |
In the paper module, messages support MiniMessage formatting (e.g. <red>, <bold>). In the spigot module, messages use legacy Minecraft color codes with & as the formatting character (e.g. &c for red) instead.
Command
The following commands are available on the backend server (Paper or Spigot):
/proxiedcommand <server> <command>
/proxiedcommandother <player> <server> <command>
The commands also have aliases: /proxied_command and /pcmd for /proxiedcommand, and /proxied_command_other, /pcmdother, and /pcmdo for /proxiedcommandother.
<server> – Name of the target server, as registered in the proxy configuration (for example velocity.toml).
<command> – The command to execute on the target server. Arguments may contain spaces.
<alias> – An alias defined in config.yml that maps an alias/command name to a target server.
<player> – An online player who should be connected and have the command executed.
/proxiedcommand can only be executed by players. /proxiedcommandother can also be executed from the console.
Permissions
If need-permission is set to true in config.yml, a player needs one of the following permissions to execute /proxiedcommand <server> <command>:
| Permission |
Effect |
proxiedcommand.command.* |
Allows executing all commands. |
proxiedcommand.command.<command> |
Allows executing a specific command (spaces are replaced with underscores). |
For /proxiedcommandother, the corresponding permissions are proxiedcommand.command.other.* and proxiedcommand.command.other.<command>.
Permissions are matched by prefix, so it is not necessary to specify the complete command. For example, with need-permission: true:
proxiedcommand.command.gamemode allows both gamemode creative and gamemode survival.
proxiedcommand.command.gamemode_creative allows gamemode creative, but not gamemode survival.
Command spaces are replaced with underscores when the permission is built. The same prefix behavior applies to the corresponding proxiedcommandother permissions.
If both permissions are missing, the player receives the error message configured in message.permission, and the request is not sent to the proxy.
If need-permission is set to false (default), no permission check is performed and every player can use the command for every registered server.
Requirements
- A Velocity or BungeeCord proxy with the matching proxy module (
velocity or bungeecord).
- A Paper based backend server (with the
paper module) or a Spigot based backend server (with the spigot module).
- The commands being executed must be available on the target backend server.
- Java version 25 or higher.
Known Limitations
- Proxied Command itself does not check whether the specified command exists – command validation and execution are handled by the target server.
评论 0
登录后参与评分
还没有评论,来抢沙发吧