CustomCommands

一个用于创建自定义命令的 Velocity 插件。

资源图片
# CustomCommands 适用于 Velocity 这是一个 Velocity 插件,允许您创建自定义命令。 它为您提供了一种创建可以由玩家执行的命令的简单方法。 这些命令可以根据您的喜好进行定制。 ## 安装 1. 从 [modrinth](https://modrinth.com/plugin/customcommandsvelocity/versions) 下载最新版本。 2. 将 jar 文件放入 `plugins/` 目录中。 3. 重新启动您的服务器。 ## 使用 | 命令 | 描述 | 权限 | |---------------------------|-----------------------------------------------------------|--------------------------| | `/customcommands reload` | 重新加载配置文件和所有自定义命令 | `customcommands.reload` | | `/customcommands list` | 列出所有自定义命令 | `customcommands.list` | | `/customcommands help` | 显示帮助页面 | `customcommands.help` | | `/customcommands version` | 显示插件的版本 | `customcommands.version` | | `/customcommands` | 显示帮助页面 | `customcommands.help` | 所有这些命令都需要其各自的权限或 `customcommands.admin` 权限。 它们也可以通过 `/cc` 执行。 ### `/customcommands list` 此命令会显示所有自定义命令的列表,如下所示:
![https://raw.githubusercontent.com/thevalleyy/CustomCommands/refs/heads/master/img.png](https://raw.githubusercontent.com/thevalleyy/CustomCommands/refs/heads/master/img.png) ## 配置 ### `config.toml` 配置文件位于 `plugins/customcommands/config.toml`。
config.toml 的内容 ```toml # CustomCommands 配置 # 这是显示在所有消息前面的前缀 # 仅支持 MiniMessage,请参阅 https://docs.advntr.dev/minimessage/format.html 和 https://webui.advntr.dev/ 获取更多信息 Prefix = "[CustomCommands]" # 当玩家无权执行命令时,将显示此默认消息 No-Permission = "您无权执行此命令。" # 当命令从控制台运行,但命令不允许从控制台运行时,将显示此默认消息 No-Console-Command = "此命令不能从控制台运行!" # 命令执行成功时显示的默认消息 Command-Executed = "命令执行成功。" # 不要更改此项 Config-Version = 1.0 ```
### 自定义命令 在 `plugins/customcommands/Commands/` 中创建您的自定义命令。 每个命令保存在单独的 toml 文件中。
默认命令文件 (DefaultCommand.toml) 的内容 ```toml # 命令配置 # 启用? Enabled = true # 这是用于在聊天中调用命令的命令名称 Name = "defaultcommand" # 这些是别名。如果不需要任何别名,则清空该数组,例如:Aliases = [] Aliases = ["default", "defaultcmd"] # 这是在帮助命令中显示的命令描述 Description = "这是 CustomCommands 的默认命令" # 执行命令所需的权限。如果为空,则不需要权限 Permission = "customcommands.defaultcommand" # 这是在调用命令时发送的响应。如果为空,则没有响应 # 仅支持 MiniMessage,请参阅 https://docs.advntr.dev/minimessage/format.html 和 https://webui.advntr.dev/ 获取更多信息 Response = "命令执行成功!" # 将 config.toml 中配置的插件前缀添加到响应消息 UsePrefix = true # 这是命令的冷却时间,以秒为单位 Cooldown = 0 # 执行的代理命令。代码在控制台上运行,无需进行任何权限检查。如果不需要代理命令,则为空 # 要查看所有占位符,请参阅 https://github.com/thevalleyy/CustomCommands?tab=readme-ov-file#placeholders # 示例:ProxyCommand = "send %player% hub" ProxyCommand = "" ```
## 占位符 * `%player%` - 执行命令的玩家