Skip to content

事件 API ​

Gem 事件位于 emaki.jiuwu.craft.gem.api.event. 线程与派发契约: 所有事件同步发布在 actor owner thread; 公开 operations 在错误线程调用时直接拒绝, runtime 内部入口在无法取得 ownership 时不派发 pre 事件, 仍继续既定流程

事件触发时机Cancellable可修改字段取消/结果效果路径与 operationId
GemInlayEvent校验后, 开始扣费或摇点前是successChance, clamp 0–100停止镶嵌service/API/GUI 等镶嵌路径; 生成 operationId
GemExtractEvent校验后, 扣费与移除前是无停止拆卸direct/API 与 held-item/GUI service 路径; 生成 operationId
GemSocketOpenEvent槽位与 opener 校验后, 开孔与消耗前是无停止开孔和 opener 消耗socket opener 的 direct/GUI 路径; 包含 operationId
GemInlayCompletedEventsuccess actions 完成且 journal 到达终态后; 已完成补偿的失败也可发否无post, 不可回滚与 pre 事件共享 operationId; successful=false 时读取 reasonKey
GemExtractCompletedEvent状态提交, success actions 完成且 journal COMPLETED 后否无post, 不可回滚API/direct/held-item 等实际 commit 路径, 与 pre 事件共享 operationId

Completed 事件的触发时机不是"方法返回新装备时立即触发": 事务先返回或提交状态, 再等待 action stage 与持久 journal 到达终态. 若 actor 已离线或 owner scheduler 退役, runtime 记录该情况并跳过 completed event. 两个 completed 事件均不实现 Cancellable