/savewaypoint
基本信息
| 属性 | 值 |
|---|---|
| 类型 | 客户端命令(ClientCommandHandler 注册) |
| 命令名 | savewaypoint |
| 注册类 | com.muxiu1997.sharewhereiam.command.CommandWaypointSave |
| 权限等级 | 0(任何玩家可用,由 CommandWaypointBase#getRequiredPermissionLevel 强制) |
| 适用侧 | 仅客户端(命令仅在 ClientProxy.postInit 中注册到 ClientCommandHandler.instance) |
行为
命令从一个 Base64 编码的 SharedWaypoint JSON 中解码出 Waypoint 并保存到 JourneyMap 中。
参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
<waypoint code> |
Base64 编码字符串 | 是 | WaypointUtil.toBase64(SharedWaypoint) 生成的 Base64,包含 Waypoint 的 JSON |
[open editor?] |
布尔字符串 | 否 | 是否打开编辑面板。值:true / false。默认:true(即当只有一个参数时也打开编辑器) |
任何超出 1~2 个参数长度的输入都会抛
sharewhereiam.command.savewaypoint.usage错误(即「Usage: …」)。 Base64 解码失败(任何Exception)都会抛sharewhereiam.commanderror.invalidcode(即「Invalid waypoint code」)。
JourneyMap 版本分支
JourneyMap 5(legacy)
- 解析 Base64 →
SharedWaypoint.fromString→ 转换成 JourneyMapWaypoint对象。 - 若
open editor == true:- 调用
UIManager.getInstance().openWaypointEditor(journeyMapWaypoint, true, null)。 - 返回
SaveResult.EDITOR_OPENED,客户端不会输出聊天。
- 调用
- 若
open editor == false:- 通过
IMixinWaypointStore检查 WaypointStore 中是否已存在同 ID(exists(journeyMapWaypoint))。 - 已存在 → 返回
SaveResult.EXISTS,客户端发「Waypoint exists, can’t save」。 - 不存在 →
WaypointStore.instance().save(journeyMapWaypoint),返回SaveResult.SAVED,客户端发「Waypoint saved」。
- 通过
JourneyMap 6(v2 API)
无论第二个参数为何,编辑器永远不打开(JourneyMapIntegration.canOpenWaypointEditor() 仅 V5 返回 true,V6 返回 false):
- 第二个参数被忽略,
openWaypointEditor永不调用。 - 通过
IClientAPI.getAllWaypoints()遍历所有已存在 Waypoint,使用JourneyMapV6Plugin.isDuplicate比对(x, y, z, groupId, primaryDimension)。 - 已存在 →
SaveResult.EXISTS→ 发「Waypoint exists, can’t save」。 - 不存在 →
api.addWaypoint(MOD_ID, converted)→ 发「Waypoint saved」。
触发来源
该命令通常由聊天中 [Save] 按钮触发:
- V5:
/savewaypoint <base64> false(直接保存,不打开编辑器) - V6:
/savewaypoint <base64> false(同上,第二个参数被忽略)
数值
| 数值 | 值 |
|---|---|
| 参数最小长度 | 1 |
| 参数最大长度 | 2 |
默认 openWaypointEditor |
true |
| V5 重复判定 | WaypointStore 内 ID 完全一致 |
| V6 重复判定 | 5 元组:(x, y, z, groupId, primaryDimension) |
相关条目
- /sharewhereiam 命令 - 命令别名(
Ctrl + Shift + INSERT也调用此命令的同类路径) - /toggletempbeacon 命令 - 临时 Beacon 切换
- WaypointShare 按键 - 触发命令的来源之一