动作

动作系统提供了由插件提供的预设效果。但是,您也可以使用API添加自己的动作。此系统可应用于触发动作的任何地方,例如当您成功捕捉到鱼时,比赛结束并发放奖励时,或者出售鱼时。

动作由三部分组成

type: 动作类型
value: 动作的参数
chance: 可选(0~1 默认: 1)

如果值是整数或双精度值,则可以使用表达式,例如

exp_action:
  type: exp
  value: '{level} * 3'

动作库

message(向玩家发送消息)

messages_action:
  type: message
  value:
    - '<#FF4500>[1st] 恭喜!您获得了一等奖!'

random-message(从列表中随机发送消息)

message:
  type: random-message
  value:
    - '消息1'
    - '消息2'
    - '消息3'

broadcast(向在线玩家发送消息)

broadcast_action:
  type: broadcast
  value:
    - '<#D4F2E7>◤─────────────────────────◥'
    - ''
    - '             <gray>[<#87CEFA>🎣<gray>]  <gradient:#F0F8FF:#87CEFA:#F0F8FF>钓鱼比赛'
    - ''
    - '      <#E1FFFF>目标:'
    - '         <#B0C4DE>尽可能多地捕捉鱼'
    - '           <#B0C4DE>开始钓鱼以参加比赛!'
    - ''
    - '<#D4F2E7>◣─────────────────────────◢'

command(执行控制台命令)

command_action:
  type: command
  value:
    - 'money give {player} 200'

player-command (以玩家身份执行命令)

command_action:
  type: player-command
  value:
    - 'say hello'

random-command(从列表中随机执行控制台命令)

command_action:
  type: random-command
  value:
    - 'money give {player} 200'
    - 'money give {player} 100'
    - 'money give {player} 50'

close-inv(关闭玩家当前打开的物品栏)

close_action:
   type: close-inv

actionbar

actionbar_action:
  type: actionbar
  value: '您好'

random-actionbar

actionbar_action:
  type: random-actionbar
  value: 
    - 'Hi'
    - '你好'
    - 'Hola'

mending(给予玩家应用于修复的经验值)

mending_action:
  type: mending
  value: 1

exp(直接给玩家经验值以升级)

exp_action:
  type: exp
  value: 1

chain(作为一组执行动作)

chain_action:
  type: exp
  value: 
    action_1: ...
    action_2: ...
  chance: 0.5

delay(延迟 x 个tick)

delay_action:
  type: delay
  value: 
    delay: 20
    async: false
    actions:
      action_1: ...
      action_2: ...

timer

timer_action:
  type: timer
  value: 
    delay: 3
    async: false
    duration: 20
    period: 2
    actions:
      action_1: ...
      action_2: ...

title

title_action:
  type: title
  value:
    title: '<green>GG!</green>'
    subtitle: '您捕捉到了一条 {nick}'
    fade-in: 20
    stay: 30
    fade-out: 10

random-title

title_action:
  type: random-title
  value:
    titles:
      - '<green>GG!</green>'
      - '<green>干得好!</green>'
    subtitles:
      - '您捕捉到了一个 {loot}'
      - '哇!好的捕获!'
      - '哦,{loot},我们来了!'
      - '让我们看看是什么!'
    fade-in: 20
    stay: 30
    fade-out: 10

sound

sound_action:
  type: sound
  value:
    key: 'minecraft:block.amethyst_block.place'
    source: 'player'
    volume: 1
    pitch: 1

potion-effect

potion_action:
  type: potion-effect
  value:
    type: 'blindness'
    duration: 20
    amplifier: 0

plugin-exp(来自其他插件的经验,例如工作/技能插件)

plugin_exp_action:
  type: plugin-exp
  value:
    plugin: mcMMO
    exp: 20
    target: FISHING

conditional(仅当玩家满足条件时才触发动作)

conditional_action:
  type: conditional 
  value:
    conditions:
       ...
    actions:
       ...

priority(执行满足条件的第一个动作组。)

priority_action:
  type: priority
  value:
    priority_1:
      conditions:
         ...
      actions:
         ...
    priority_2:
      conditions:
         ...
      actions:
         ...
    others:
      actions:
         ...   

fake-item(显示一段时间的虚假物品) 注意:"opposite-yaw" 和 "yaw" 不能同时使用

fake_item_action:
  type: fake-item
  value:
    duration: 25     <- ticks
    position: other  <- other/player
    item: water_effect
    use-item-display: true # 是否使用文本展示实体(1.19.4+)
    y: 0             <- y 偏移
    x: 0             <- x 偏移
    z: 0             <- z 偏移 
    yaw: 0
    opposite-yaw: true
    range: 0        # 如果 range = 0,只有一个玩家能看到全息图

hologram(显示一段时间的全息图)

hologram_action:
  type: hologram
  value:
    duration: 20     <- ticks
    text: '{player} 捕捉到了一个 {loot}!'
    position: player <- other/player
    use-text-display: true # 是否使用文本展示实体(1.19.4+)
    rgba: 0,0,0,0
    range: 16       # 如果 range = 0,只有一个玩家能看到全息图
    y: 2             <- y 偏移
    x: 0             <- x 偏移
    z: 0             <- z 偏移 

fish-finder

finder_action:
  type: fish-finder
  value: false(false: 水 / true: 熔岩)

message-nearby

message_action:
  type: message-nearby
  value: 
    message: 
      - '您好 {near}。此消息由 {player} 发送'
    range: 32

command-nearby

command_action:
  type: command-nearby
  value: 
    command: 
      - 'give {near} apple'
    range: 32

actionbar-nearby

actionbar_action:
  type: actionbar-nearby
  value: 
    actionbar: '这是一个动作栏'
    range: 32

title-nearby

title_action:
  type: title-nearby
  value: 
    title: '<green>标题</green>'
    subtitle: '副标题'
    fade-in: 20
    stay: 30
    fade-out: 10
    range: 32

food

https://zh.minecraft.wiki/w/%E9%A5%A5%E9%A5%BF

food_action:
  type: food
  value: 2

saturation

https://zh.minecraft.wiki/w/%E9%A5%A5%E9%A5%BF

saturation_action:
  type: saturation
  value: 1.5

item-amount

item_amount_action:
  type: item-amount
  value:
    # main / off
    hand: main
    amount: -1

durability

durability_action:
  type: durability
  value:
    # hand / offhand / feet / head / chest /legs
    slot: hand
    amount: -1

give-item

item_action:
  type: give-item
  value:
    item: CustomFishing:rod:star_rod
    amount: 1

give-money

money_action:
  type: give-money
  value: 100.12

take-money

money_action:
  type: take-money
  value: 50.54

level

money_action:
  type: level
  value: -10

最后更新于