Class SendRconCommandApi
java.lang.Object
io.github.theword.queqiao.core.api.Api<CommandPayload,String>
io.github.theword.queqiao.core.api.SendRconCommandApi
通过 RCON 执行命令
协议名:send_rcon_command。
该 Api 与平台无关——它只依赖 Runtime 注入的 RCON 执行器,
因此不继承 PlatformApi,也不要求平台上下文。
状态码语义(不同失败原因不统一归为 400):
- 命令为空 → 400(调用方请求不合法)
- Rcon 未启用 / 未连接 → 503(服务暂不可用)
- 命令已下发但执行失败 → 500(服务端错误)
日志:不在 INFO 级别记录完整命令内容,因为命令可能包含密码、token 或玩家隐私; 完整内容仅在显式开启 debug 时输出。
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionSendRconCommandApi(org.slf4j.Logger logger, RconCommandExecutor rconCommandExecutor) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringdoExecute(CommandPayload payload) 处理已经解析好的负载name()协议api字段的主名字,例如"broadcast"Methods inherited from class io.github.theword.queqiao.core.api.Api
aliases, execute, mapPlatformResult, requireSuccess
-
Constructor Details
-
SendRconCommandApi
-
-
Method Details
-
name
Description copied from class:Api协议api字段的主名字,例如"broadcast"- Specified by:
namein classApi<CommandPayload,String> - Returns:
- api 名字
-
doExecute
Description copied from class:Api处理已经解析好的负载- Specified by:
doExecutein classApi<CommandPayload,String> - Parameters:
payload- 负载,永不为 null- Returns:
- 处理结果
- Throws:
ProtocolException- 处理失败
-