Proxied Command

插件

· 作者 mrcl-at

Proxied Command 允许玩家在不同服务器间执行命令

0 本站下载 0 关注 更新于 2 个月前

最新 1.0.0 · 26.2 · Velocity

一键开服(送7天)

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 进行。

工作流程如下:

  1. 玩家执行命令 – 在后端服务器上,玩家调用注册的命令并指定目标服务器和要执行的命令(例如 /proxiedcommand farmworld home farmhome)。
  2. 后端插件发送消息 – 插件(根据服务器类型选择 paper 或 spigot 模块)首先检查输入内容和权限,然后构建消息 <player> <server> <command> 并通过通道以插件消息的形式发送给代理服务器。
  3. 代理插件处理请求(Velocity 或 BungeeCord):
    • 检查指定的玩家和目标服务器是否存在。
    • 如果玩家已经在目标服务器上,则直接转发消息。
    • 否则,先建立到目标服务器的连接,仅在服务器切换成功后才转发消息。
  4. 目标服务器执行命令 – 目标服务器上的插件接收转发的消息,检查玩家是否在该服务器上在线,并以该玩家的身份调度给定的命令。

安装

  1. 将对应的代理模块放入代理服务器的 plugins 文件夹中:velocity 用于 Velocity,bungeecord 用于 BungeeCord。
  2. 在每个希望玩家能够触发或接收命令的后端服务器上安装对应的后端模块:在 Paper 服务器上安装 paper 模块,在 Spigot 服务器上安装 spigot 模块。
  3. 重启代理服务器和相关后端服务器。

配置(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 本身不会检查指定的命令是否存在——命令验证和执行由目标服务器处理。

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源