快捷指令
一个 Minecraft 插件,用于创建无需其他插件的指令快捷方式。
支持重载!当执行 /reload 时,本插件不会产生任何负面影响:指令将根据配置文件的更改被禁用并重新添加。
配置
每个指令都可以单独配置。
基本的 YAML 结构如下:
# 这是你在游戏中输入的指令名称/标签(例如 /command_name)
command_name:
# 可选的使用权限,可以是任意字符串
# 如果发送者没有此权限,则无法运行此快捷指令
permision: example.permission
# 如果该指令只能由玩家执行(这也是可选的)
# 对于非玩家实体,执行方法将立即返回
playerOnly: false
# 可选的描述,说明应如何使用该指令
usage: "/command_name <value>"
# 实际用于控制快捷指令功能的执行部分
executions:
- {
# 要运行的指令
# %%0 会被提供的第一个参数替换,%%1 是第二个,依此类推
# 如果愿意,可以使用占位符
run: say %%0,
# 以谁的身份运行该指令
# 必须是 "sender"(发送者)或 "console"(控制台)之一
as: sender
}
- {
# 这是一条发送给用户的消息
# 此处可以使用格式化和占位符
display: Example message with §aFormatting!
}
示例
以下是一个“gmc”指令快捷方式的示例:
本示例使用了占位符,如果你希望使用它,请确保已安装 PlaceHolderApi。
# 要使用的指令标签
gmc:
# 运行此快捷指令所需的权限
# 这不会绕过代理时对原始指令的检查!
# 此处不支持占位符
permission: command.gamemode
# 如果该指令只能由玩家运行
# 此处不支持占位符
playerOnly: true
# 当发出无效版本的此指令时显示
# 此处不支持占位符
usage: /gmc
executions:
# 以发送者的身份运行指令 "gamemode creative"
# 此处可以使用占位符
- { run: gamemode creative %player_name%, as: console }
# 向执行者显示此消息
# 此处可以使用占位符
- { display: "§0[§a✓§0]§r You are now in creative mode" }
下面是对各个元素的解释:
| 组件 |
使用的值 |
描述 |
| 权限 |
command.gamemode |
指定运行“gmc”指令所需的权限。尝试执行此指令的用户必须拥有“command.gamemode”权限。 |
| 仅限玩家 |
true |
设置为 true 时,此配置确保只有玩家(而非控制台或其他实体)才能执行“gmc”指令。 |
| 用法 |
/gmc |
“usage”字段指定用户调用“gmc”指令时应遵循的指令语法。 |
执行步骤 1
| 操作 |
运行的指令 |
作为发送者 |
| 运行指令 |
gamemode creative %player_name% |
console |
此步骤指示系统将执行者的游戏模式设置为创造模式。%player_name% 占位符会被执行者的名称替换。该指令以控制台身份执行。
执行步骤 2
| 操作 |
显示的消息 |
| 显示消息 |
"§0[§a✓§0]§r You are now in creative mode" |
此步骤向执行者显示一条消息,表明他们现在处于创造模式。该消息包含格式化代码以提升视觉效果。
Shortcut
A Minecraft plugin for creating command shortcuts without needing another plugin
Reload ready! This plugin has no adverse effects when /reload is executed: commands will be disabled and added according to the changes to the configuration
Configuration
Each command can be individually configured
The basic yaml structure is as follows:
# This is the command name/label that you will type ingame (think /command_name)
command_name:
# An OPTIONAL permission to use, this can be anything
# If the sender doesn't have this permission they cannot run this shortcut
permision: example.permission
# If the command can only be executed by players (this is also optional)
# For none players the execution method returns instantly
playerOnly: false
# An OPTIONAL way to describe how the command should be used
usage: "/command_name <value>"
# What is actually used to control what the shortcut does
executions:
- {
# This is the command to run
# %%0 is replaced with the first argument provided, %%1 is the second and so on
# Placeholders can be used if you so choose
run: say %%0,
# Who to run the command as
# Must be either "sender" OR "console"
as: sender
}
- {
# This is a message that is to be sent to the user
# Formatting and placeholders can be used here
display: Example message with §aFormatting!
}
Example
The following is an example for a "gmc" command shortcut:
Placeholders are utilised in this example, ensure you have PlaceHolderApi if you wish to use it
# the command label to use
gmc:
# permission required to run this shortcut
# this doesn't bypass the check on the original command if proxying!
# placeholders do NOT work here
permission: command.gamemode
# if the command can only be ran by a player
# placeholders do NOT work here
playerOnly: true
# displayed when an invalid version of this command is issued
# placeholders do NOT work here
usage: /gmc
executions:
# runs the command "gamemode creative" as the sender
# placeholders can be used here
- { run: gamemode creative %player_name%, as: console }
# displays this message to the executor
# placeholders can be used here
- { display: "§0[§a✓§0]§r You are now in creative mode" }
Below is each element explained:
| Component |
Used Value |
Description |
| Permission |
command.gamemode |
Specifies the permission required to run the "gmc" command. Users attempting to execute this command must have the "command.gamemode" permission. |
| Player-Only |
true |
When set to true, this configuration ensures that only players (as opposed to console or other entities) can execute the "gmc" command. |
| Usage |
/gmc |
The "usage" field specifies the command syntax that users should follow to invoke the "gmc" command. |
Execution Step 1
| Action |
Command to Run |
As Sender |
| Run a command |
gamemode creative %player_name% |
console |
This step instructs the system to set the executor's game mode to creative. The %player_name% placeholder is replaced with the executor's name. The command is executed as the console.
Execution Step 2
| Action |
Message to Display |
| Display a message |
"§0[§a✓§0]§r You are now in creative mode" |
This step displays a message to the executor indicating that they are now in creative mode. The message includes formatting for visual appeal.
评论 0
登录后参与评分
还没有评论,来抢沙发吧