指令

Schematica 注册 4 条服务端指令,全部继承 1.7.10 原版 CommandBase(不是 Brigadier)。

注册条件

CommonProxy.serverStarting()(CommonProxy.java:66-72):

if (ConfigurationHandler.serversideSchematicsEnabled) {
    event.registerServerCommand(new CommandSchematicaSave());
    event.registerServerCommand(new CommandSchematicaList());
    event.registerServerCommand(new CommandSchematicaRemove());
}

只有 3 条被实际注册。serversideSchematicsEnabled(默认 true)为 false 时,4 条指令全部消失。

指令清单

指令名常量在 reference/Names.Command.*.NAME:

指令 类 作用 权限
/schematicaSave CommandSchematicaSave 以玩家当前选择的两点保存蓝图 继承基类(CommandSchematicaBase)
/schematicaList CommandSchematicaList 分页浏览服务器蓝图 同上
/schematicaRemove CommandSchematicaRemove 删除服务器蓝图(需二次确认) 同上
/schematicaDownload CommandSchematicaDownload 下载蓝图 ⚠️ 从未注册,死类

CommandSchematicaBase 覆写了 getRequiredPermissionLevel(),源码中可见的返回值为 0(CommandSchematicaBase.java:11),即任何玩家都能执行保存与列表指令。删除操作靠 schematicaRemove 自己的二次确认流程把关,而非权限等级。

消息键

全部走 Names.Command.*.Message 常量(reference/Names.java):

指令 消息键
Save schematica.command.save.usage / .playersOnly / .started / .saveSucceeded / .saveFailed / .quotaExceeded / .playerSchematicDirUnavailable
List schematica.command.list.usage / .notAvailable / .remove / .download / .header / .noSuchPage / .noSchematics
Remove schematica.command.remove.usage / .schematicRemoved / .schematicNotFound / .areYouSure
Download schematica.command.download.usage / .started / .downloadSucceeded / .downloadFail

⚠️ 三处消息键前缀写错为 schematica.command.save.*,实际应属于各自指令:

  • CommandSchematicaRemove 的「仅玩家可用」提示用了 schematica.command.save.playersOnly(Names.java 的 Remove.Message.PLAYERS_ONLY);
  • CommandSchematicaDownload 的「仅玩家可用」提示同样用了 schematica.command.save.playersOnly。

因为语言文件里这些键确实存在(都是同一份文案),玩家看到的内容正确,不会暴露为原始 key——属于「巧合可用」的技术债,改名才会出问题。

二次确认

schematicaRemove 的删除流程是两步(Names.Command.Remove.Message):

  1. 首次执行发 areYouSure 确认问句与 gui.yes 选项;
  2. 确认后才真正删除并发 schematicRemoved;找不到文件则发 schematicNotFound。

已知缺陷

  • CommandSchematicaDownload 是死类。全仓无实例化点(CommonProxy.java:68-70 只 new 了 Save / List / Remove)。下载入口在 /schematicaList 的交互列表中(List.Message.DOWNLOAD 键),因此玩家从指令层面永远看不到 /schematicaDownload,即使它能工作。

  • 权限等级为 0。CommandSchematicaBase 返回 0,意味着生存模式玩家可任意保存蓝图。saveEnabled / loadEnabled / printerEnabled 三个配置项才是实际的开关,服务端若要限制功能应关这些而不是指望指令权限。

  • 配额超限只在保存时检查。CommandSchematicaSave.java:38 调 Schematica.proxy.isPlayerQuotaExceeded(player),超限时发 quotaExceeded 并拒绝。判定是目录总字节数(见 蓝图格式),已超限的玩家即使删除旧蓝图也可能因空间未释放而继续被拒。

相关条目

  • 蓝图格式 - 保存的目录、配额与数据布局
  • 配置 - serversideSchematicsEnabled 决定指令是否存在