Info 和 Info 响应器
Info
- class mcdreforged.info_reactor.info.Info(source: InfoSource, raw_content: str)[源代码]
一个
Info
信息对象包含了从服务器或控制台解析的结果- source: InfoSource
一个 int(实际上是
InfoSource
,一个 int 的子类),表示该信息的类型若该信息是来自服务端的标准输出流,则为
0
若来自控制台输入,则为
1
见
InfoSource
以了解所有可能的取值
- property is_from_console: bool
信息源是否是
InfoSource.CONSOLE
(1
),即是信息否来自控制台
- property is_from_server: bool
信息源是否是
InfoSource.SERVER
(0
),即是信息否来自服务端
- get_server() ServerInterface [源代码]
返回 ServerInterface 实例
- get_command_source() InfoCommandSource | None [源代码]
从此对象中提取出一个指令源对象
ConsoleCommandSource
,如果该信息来自控制台PlayerCommandSource
,如果该信息来自服务端中的玩家
- 返回:
返回指令源实例。如果无法提取指令源,则返回 None
- to_command_source() InfoCommandSource [源代码]
与方法
get_command_source()
一样,只不过它会在无法提取指令源时抛出一个IllegalCallError
- 抛出:
IllegalCallError – 如果此无法从这个对象中提取指令源