1.19高版本中 ParseResult 类和 dispatcher.execute() 的使用

请注意时效性!文章创建于:2023-08-05

Dispatcher

从 1.19 之后 getCommandManager().execute()execute() 第一个形参从 ServerCommandSource 类变成了 ParseResult<ServerCommandSource> 类了。

看了下,ParseResult 似乎是对命令解析的返回结果,包含 CommandContext<ServerCommandSource>ImmutableStringReader 其他类或接口在内构成了一个解析的结果,导向消息的发送人、指令的内容和抛出的异常。

没有办法直接从 CommandContext<ServerCommandSource> 类中获取到解析结果,必须使用 dispatcher 指令调度器进行解析。

1
2
ParseResults<ServerCommandSource> parseResults = dispatcher.parse(COMMAND, context.getSource()); // 对指令进行解析
dispatcher.execute(parseResults); // 从解析结果中执行

1.19高版本中 ParseResult 类和 dispatcher.execute() 的使用
http://htext.top/post/f4139b0d.html
作者
Huanlan233
发布于
2023年8月5日
许可协议