Skip to content

命令: command

Tip

由于文本格式敏感,我们正常在游戏中需要用到空格以及斜杆

在设置目标时候是如何体现或者代替的呢? 空格采用: _ ,斜杠则采用\

当然支持占位符例如%player%


可选参数:

  • ignoreCase:忽略输入目标而匹配命令
  • exact: 更为精确的匹配命令内容
  • cancel:如果提供,目标将取消对比赛的命令执行。在使用自定义命令时,需要启用此功能来抑制消息。Unknown Command
  • failEvents: 如果提供,则指定执行事件列表(如果运行了不匹配的命令并满足了条件)。

官方例子

Example
command /warp_%player%_farms events:event1,event2
command //replace_oak\_wood events:event1,event2

高级例子

Example
command /warp_%player%_farms ignoreCase exact cancel
failEvents:failEvent1,failEvent2 events:event1,event2

Warning

Sometimes you want to use actual underscores in your command. These will however be replaced with spaces by default. You can "escape" them using backslashes: One backslash () is required when using no quoting at all () or single quotes (). Two backslashes are required () when using double quotes ().\``...``'...'``\\``"..."

Examples: eventName: command /enchant_@s_minecraft:aqua_affinity ![➡] eventName:command /enchant_@s_minecraft:aqua\_affinity eventName: 'command /enchant_@s_minecraft:aqua_affinity' ![➡] eventName: 'command /enchant_@s_minecraft:aqua\_affinity' eventName: "command /enchant_@s_minecraft


视频教程