CoreLib 动作
EmakiAttribute 启用后会向 CoreLib 动作注册表追加属性、资源、标签和同步相关动作。它们可以写在支持 CoreLib Action 的配置节点中,例如 Forge/Strengthen/Cooking/Skills/Item 的动作列表、CoreLib 动作模板,或由其他插件通过 CoreLib ActionExecutor 触发。
本页只记录 EmakiAttribute 注册的 CoreLib 动作;CoreLib 自带的消息、命令、经济、物品、脚本等通用动作见 CoreLib 动作系统。当前 Action ID 只使用下表中的规范名,不再提供历史别名入口。
动作 ID 速查
| 动作 ID | 用途 | 需要玩家上下文 |
|---|---|---|
attributedamage | 对当前玩家造成一次 Attribute 自定义伤害。 | 是 |
attribute_add | 给当前玩家添加临时属性值。 | 是 |
attribute_set | 设置当前玩家的临时属性值。 | 是 |
attribute_remove | 移除当前玩家指定 effect_id 的临时属性。 | 是 |
attribute_resource_consume | 消耗当前玩家指定资源。 | 是 |
attribute_resource_add | 增加当前玩家指定资源当前值。 | 是 |
attribute_resource_set | 设置当前玩家指定资源当前值。 | 是 |
attribute_resource_remove | 扣除当前玩家指定资源当前值。 | 是 |
attribute_tag_add | 按属性标签批量添加临时属性。 | 是 |
attribute_tag_remove | 按属性标签移除临时属性。 | 是 |
attribute_tag_clear | 按属性标签清理临时属性。 | 是 |
attribute_sync | 同步当前玩家或全部在线玩家属性/资源状态。 | all=false 时是 |
attribute_refresh | 刷新 Attribute 缓存,并同步当前玩家或全部在线玩家。 | all=false 时是 |
attributedamage
对当前动作上下文中的玩家造成一次 Attribute 伤害。伤害类型为空时使用 EmakiAttribute 的默认伤害类型。
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
amount | DOUBLE | 是 | — | 基础伤害值。 |
type | STRING | 否 | "" | 伤害类型 ID;留空使用默认伤害类型。 |
cause | STRING | 否 | CUSTOM | Bukkit EntityDamageEvent.DamageCause,如 CUSTOM、MAGIC、ENTITY_ATTACK。 |
yaml
actions:
- 'attributedamage amount=25 type=physical cause=CUSTOM'临时属性动作
临时属性按 effect_id 标识。重复写入同一个 effect_id 时,会命中同一条临时属性记录;具体加算或覆盖行为由属性定义的 temporary_stack_mode 和动作实现决定。
attribute_add
给当前玩家添加临时属性值。
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
effect_id | STRING | 是 | — | 临时效果 ID。 |
attribute | STRING | 是 | — | 属性 ID。 |
value | DOUBLE | 是 | — | 临时属性值。 |
duration_ticks | TIME | 是 | — | 持续时间,必须大于 0;支持 CoreLib 时间写法。 |
yaml
actions:
- 'attribute_add effect_id=forge_bonus attribute=physical_attack value=12 duration_ticks=10s'attribute_set
设置当前玩家的临时属性值。参数与 attribute_add 相同。
yaml
actions:
- 'attribute_set effect_id=arena_buff attribute=physical_attack value=30 duration_ticks=200t'attribute_remove
移除当前玩家指定 effect_id 的临时属性。
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
effect_id | STRING | 是 | — | 要移除的临时效果 ID。 |
yaml
actions:
- 'attribute_remove effect_id=arena_buff'资源动作
资源动作会通过 EmakiAttribute 的资源同步边界修改玩家资源当前值;resource 必须是已加载的资源 ID。
| 动作 ID | amount 要求 | 说明 |
|---|---|---|
attribute_resource_consume | > 0 | 消耗资源,最低扣到 0。 |
attribute_resource_add | > 0 | 增加资源当前值,并按资源同步规则截断。 |
attribute_resource_set | >= 0 | 设置资源当前值。 |
attribute_resource_remove | > 0 | 扣除资源,最低扣到 0。 |
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
resource | STRING | 是 | — | 资源 ID,如 health、mana。 |
amount | DOUBLE | 是 | — | 操作数量。 |
yaml
actions:
- 'attribute_resource_consume resource=mana amount=20'
- 'attribute_resource_add resource=mana amount=10'
- 'attribute_resource_set resource=stamina amount=100'
- 'attribute_resource_remove resource=rage amount=5'标签临时属性动作
attribute_tag_add 会对所有带指定标签的属性添加临时值;attribute_tag_remove 与 attribute_tag_clear 会移除这些标签属性对应的临时属性。
attribute_tag_add
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
tag | STRING | 是 | — | 属性标签,不区分大小写。 |
value | DOUBLE | 是 | — | 对每个命中属性施加的临时值。 |
duration_ticks | TIME | 是 | — | 持续时间,必须大于 0。 |
effect_prefix | STRING | 否 | "" | 临时效果 ID 前缀;为空时使用默认生成规则。 |
stack_mode | STRING | 否 | "" | 可选临时叠加模式,如 REPLACE、STACK。 |
yaml
actions:
- 'attribute_tag_add tag=DEBUFF value=-5 duration_ticks=5s effect_prefix=poison stack_mode=REPLACE'attribute_tag_remove / attribute_tag_clear
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
tag | STRING | 是 | — | 要移除临时属性的属性标签。 |
yaml
actions:
- 'attribute_tag_remove tag=DEBUFF'
- 'attribute_tag_clear tag=BUFF'同步动作
attribute_sync
同步当前玩家或全部在线玩家的属性/资源状态。
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
all | BOOLEAN | 否 | false | 是否同步全部在线玩家。false 时需要玩家上下文。 |
attribute_refresh
先刷新 Attribute 缓存,再同步玩家。
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
all | BOOLEAN | 否 | true | 是否同步全部在线玩家。false 时只同步当前玩家,需要玩家上下文。 |
yaml
actions:
- 'attribute_sync all=false'
- 'attribute_refresh all=true'使用提示
- 除
attribute_sync all=true与attribute_refresh all=true外,本页动作都需要玩家上下文。 - 如果需要让 MythicMobs 技能直接对目标生物添加或清除临时属性,请使用 MythicMobs 集成 中的
emaki_attribute_add、emaki_attribute_remove、emaki_attribute_add_tag、emaki_attribute_clear_tag。 duration_ticks使用 CoreLib TIME 解析,20t、1s、1000ms都可用;纯数字按 tick 处理。