Class SendPrivateMessageApi
java.lang.Object
io.github.theword.queqiao.core.api.Api<PrivateMessagePayload,PrivateMessageResponse>
io.github.theword.queqiao.core.api.PlatformApi<PrivateMessagePayload,PrivateMessageResponse>
io.github.theword.queqiao.core.api.SendPrivateMessageApi
public final class SendPrivateMessageApi
extends PlatformApi<PrivateMessagePayload,PrivateMessageResponse>
发送私聊消息
协议名:send_private_msg。
校验规则:nickname 与 uuid 至少要有一个有效。
nickname 使用 trim() 后判空,因此纯空白字符串(如 " ")视为未提供。
两者同时提供时的优先级由 AbstractPlatformContext#findPlayer 决定。
真正的"查找玩家 + 发送"由平台上下文内部完成——只有平台侧认识玩家类型;
本 Api 只把平台返回的 PlayerModel 快照组装成协议响应。
为什么覆盖了 PLAYER_NOT_FOUND 的处理路径:
迁移前"目标玩家不存在"返回的是 200 + playerNotFound 负载,
客户端据此字段判断结果。它不是协议错误,因此本 Api 在调用
Api.requireSuccess(io.github.theword.queqiao.core.platform.PlatformResult<T>) 之前先拦截该结果码,保持既有协议语义不变。
-
Field Summary
Fields inherited from class io.github.theword.queqiao.core.api.PlatformApi
platform -
Constructor Summary
ConstructorsConstructorDescriptionSendPrivateMessageApi(org.slf4j.Logger logger, AbstractPlatformContext<?, ?, ?> platform) -
Method Summary
Modifier and TypeMethodDescriptionprotected PrivateMessageResponsedoExecute(PrivateMessagePayload payload) 处理已经解析好的负载name()协议api字段的主名字,例如"broadcast"Methods inherited from class io.github.theword.queqiao.core.api.Api
aliases, execute, mapPlatformResult, requireSuccess
-
Constructor Details
-
SendPrivateMessageApi
-
-
Method Details
-
name
Description copied from class:Api协议api字段的主名字,例如"broadcast"- Specified by:
namein classApi<PrivateMessagePayload,PrivateMessageResponse> - Returns:
- api 名字
-
doExecute
Description copied from class:Api处理已经解析好的负载- Specified by:
doExecutein classApi<PrivateMessagePayload,PrivateMessageResponse> - Parameters:
payload- 负载,永不为 null- Returns:
- 处理结果
- Throws:
ProtocolException- 处理失败
-