Skip to content

事件 API

事件位于新的 emaki.jiuwu.craft.attribute.api.event 包。所有事件均为同步、可取消 Bukkit 事件,只在 runtime 拥有所需 live target 时发布。

事件触发时机线程可修改字段取消效果runtime 路径
EmakiAttributeDamageEvent伤害计算后、最终应用前target/attacker 共同 owner threadfinalDamage取消或最终值 <=0 阻止伤害damage application service;纯 calculateDamage 不发
PlayerResourceConsumeEvent资源扣减前玩家 owner threadamount阻止扣减,公开操作返回取消失败consumeResource 与进入同一 service 的 runtime 路径
PlayerAttributePointAllocateEvent属性点分配提交前玩家 owner threadamount阻止分配ParentAttributeService 分配路径
PlayerAttributePointResetEvent重置提交前玩家 owner thread阻止重置ParentAttributeService 重置路径

监听器修改值会在返回后重新校验。非 owner/异步路径不能把 Bukkit 事件 off-thread 发出;需要可靠拦截时先用 owner scheduler 调度。第三方 provider/gate 不在 event 包,而在 emaki.jiuwu.craft.attribute.api.extension