CommandKick
与其折腾权限设置,CommandKick 采取了另一种思路:命令依然完全可见且支持 Tab 补全,但一旦玩家执行了被禁止的命令,他们就会被踢出服务器并显示自定义消息。是不是很有趣?
功能特性
- 保留完整的命令树。 被禁止的命令仍然会显示出来,并且支持 Tab 补全;只有命令的执行过程会被拦截。
- 控制台安全。 服务器控制台、命令方块、数据包函数以及 rcon 可以正常运行被禁止的命令。仅拦截由玩家发起的执行请求。
- 可配置。 编辑 JSON 文件后重启即可生效——无需重新构建。
- 自定义踢出消息。 你可以自由设定玩家被踢出时看到的文本内容。
- 日志记录。 每次踢出操作都会在服务器日志中记录是哪个玩家执行了哪个命令。
- 轻量级。 不需要 LuckPerms 或其他权限系统依赖。
配置
首次启动时,CommandKick 会在 config/commandkick.json 生成带有默认值的配置文件。编辑该文件后重启服务器以应用更改——命令列表仅在启动时读取一次,因为 Brigadier 仅在启动时构建命令树。(使用 /reload 是不够的。)
{
"kickMessage": "command verboten.",
"blockedCommands": [
"tick",
"givepokemon",
"pokespawn"
]
}
每个条目都会阻止该命令及其所有子命令的运行——例如列出 tick 将覆盖 /tick freeze、/tick rate 等命令。
安装
- 安装 Fabric Loader 和 Fabric API。
- 安装 Fabric Language Kotlin。
- 将 CommandKick 放入服务器的
mods 文件夹中。
- 启动服务器一次以生成配置文件,编辑它,然后重新启动。
仅限服务端——无需客户端安装。
在 Claude 的帮助下制作
CommandKick
Instead of fiddling with permissions,CommandKick takes a different approach: the commands stay fully visible and tab-completable, but the moment a player runs a blocked one, they're kicked with a custom message. Humorous, no?
Features
- Leaves the command tree intact. Blocked commands still show up and tab-complete; only execution is intercepted.
- Console-safe. Server console, command blocks, datapack functions, and rcon run blocked commands normally. Only player-initiated runs are caught.
- Configurable. Edit a JSON file and restart — no rebuild needed.
- Custom kick message. Set whatever text players see when they get booted.
- Logging. Every kick records which player ran which command, in the server log.
- Lightweight. No LuckPerms or other permission-system dependency required.
Configuration
On first launch, CommandKick writes config/commandkick.json with defaults. Edit it and restart the server to apply — the command list is read once at startup, because Brigadier builds the command tree only at boot. (A /reload is not enough.)
{
"kickMessage": "command verboten.",
"blockedCommands": [
"tick",
"givepokemon",
"pokespawn"
]
}
Each entry blocks that command and all of its subcommands — listing tick covers /tick freeze, /tick rate, and so on.
Installation
- Install Fabric Loader and Fabric API.
- Install Fabric Language Kotlin.
- Drop CommandKick into your server's
mods folder.
- Start the server once to generate the config, edit it, then restart.
Server-side only — no client installation needed.
Made with the help of Claude
评论 0
登录后参与评分
还没有评论,来抢沙发吧