简体中文
事件 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 |
GemInlayCompletedEvent | success 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