一个简单 Minecraft 服务端模组,将非命令的 run_command 内容替换为自定义命令,
以绕过自 1.19.1-rc1 以来的客户端限制
如果你想要更直接的解决方案,这里有一个仅客户端模组,可实现相同功能: LetMeClickAndSend
| Mod | Side | Advantage | Disadvantage |
|---|---|---|---|
| LetMeClickAndSend | client | 行为与 mc1.19.1 之前完全一致 | 需要所有玩家的客户端都安装 |
| LetMeClickAndSendForServer | server | 无需在客户端安装 | 最大聊天消息长度减少 7 个字符 |
示例
让我们运行以下命令,然后点击显示的文本
# Minecraft [1.7, 1.21.5)
/tellraw @a {"text":"click me to send \"hi\"","clickEvent":{"action":"run_command","value":"hi"}}
在原版 1.19.1 ~ 1.21.4 中,点击后你无法说出任何内容,因为 hi 不是一个有效的命令(不以 / 开头)
有了这个模组,服务器会自动将上述点击事件中的 value 字段替换为 /lmcas hi,
这样客户端在点击后可以“发送”消息而不会有任何问题
收到命令后,服务器将以与玩家消息相同的格式广播一条消息,模拟玩家在聊天中说 “hi”
MC 1.21.5+
从 MC 1.21.5 开始,run_command 的行为发生了很大变化
首先是命令语法的变化,影响不大:
# Minecraft [1.21.5, ~)
/tellraw @a {"text":"click me to send \"hi\"","click_event":{"action":"run_command","command":"hi"}}
接下来是行为的变化,影响较大:
- 无论是否以
/开头,command值始终有效 - 客户端会从
command值中去除/前缀,并将剩余字符串作为命令发送
现在已无法正确区分“用于发送聊天消息的 run_command”和“用于发送命令的 run_command”
作为一种变通方案,针对 MC >= 1.21.5 的 LetMeClickAndSendForServer 仅会替换特定的 command。
默认情况下,只有以 !! 开头的 command 值会被替换,这是
MCDReforged 插件生态系统中常用的命令前缀
新增了一个位于 ./config/letmeclickandsendforserver/config.json 的配置文件,用于自定义替换行为
{
"replacePattern": "!!.*"
}
replacePattern 应为一个有效的正则表达式模式。所有完全匹配该模式的 command 值都会被替换为 /lmcas 命令
要测试默认配置,你可以使用:
/tellraw @a {"text":"click me to send \"!!MCDR\"","click_event":{"action":"run_command","command":"!!MCDR"}}
要求
这是一个仅服务端的模组。它不需要任何额外的依赖
A simple Minecraft server-side mod, that replaces all non-command run_command content with a custom command,
to bypass client-side restrictions since 1.19.1-rc1
If you want a more direct solution, here's a client-side only mod that does the same thing: LetMeClickAndSend
| Mod | Side | Advantage | Disadvantage |
|---|---|---|---|
| LetMeClickAndSend | client | Exactly the same behavior as pre mc1.19.1 | Needs to be installed on all players' clients |
| LetMeClickAndSendForServer | server | No need to install on client | Reduces maximum chat message length by 7 |
Example
Let's run the following command, and then click the shown text
# Minecraft [1.7, 1.21.5)
/tellraw @a {"text":"click me to send \"hi\"","clickEvent":{"action":"run_command","value":"hi"}}
In vanilla 1.19.1 ~ 1.21.4, after clicking, you are not able to say anything since hi is not a valid command (not starts with /)
With this mod, the server will automatically replace the value field in the click event above with /lmcas hi,
so the client can "send" the message without any issue after the click
On command received, the server will broadcast a message with the same format as a player message, simulating the player saying "hi" in chat
MC 1.21.5+
Since MC 1.21.5, the run_command behavior has changed a lot
First is the change in command syntax, which has little impact:
# Minecraft [1.21.5, ~)
/tellraw @a {"text":"click me to send \"hi\"","click_event":{"action":"run_command","command":"hi"}}
Next is the change in behavior, which has a greater impact:
- The
commandvalue is always valid, regardless of whether it starts with a/or not - The client will strip the
/prefix from thecommandvalue and send the remaining string as a command
It's no longer possible to correctly distinguish between "a run_command for sending chat message" and "a run_command for sending command"
As a workaround, LetMeClickAndSendForServer for MC >= 1.21.5 will only replace certain command with the /lmcas command.
By default, only command value starting with !!, which is a commonly-used command prefix
in MCDReforged plugin ecosystem, will be replaced
A config file located at ./config/letmeclickandsendforserver/config.json is added for customizing the replacing behavior
{
"replacePattern": "!!.*"
}
The replacePattern should be a valid regex pattern. All command values that fully match the pattern will be replaced with the /lmcas command
To test with the default configuration, you can use:
/tellraw @a {"text":"click me to send \"!!MCDR\"","click_event":{"action":"run_command","command":"!!MCDR"}}
Requirements
It's a server-side only mod. It requires 0 extra dependency
下载 Let Me Click And Send for Server
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Let Me Click And Send for Server
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Let Me Click And Send for Server
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Let Me Click And Send for Server
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Let Me Click And Send for Server
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Let Me Click And Send for Server
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Let Me Click And Send for Server
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Let Me Click And Send for Server
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Let Me Click And Send for Server
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Let Me Click And Send for Server
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
- (mc26.3) 修复模仿消息包含“System chat:”前缀的问题
构建信息
- 文件名:
LetMeClickAndSendForServer-v1.0.5-mc26.2.jar - SHA-256:
7e0f0335bb51256aeafd0d85c26a9df92830a08ba87126a9c6f2297f0a193283 - 构建来源:
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
查看物品与配方
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
AE2:一款流行的自动化与存储模组
模组
那是什么?一个 Waila/Hwyla 的分支。
评论 0
登录后参与评分
还没有评论,来抢沙发吧