ChatComponentTimeRelative
基本信息
| 属性 | 值 |
|---|---|
| 类名 | com.colen.tempora.chat.ChatComponentTimeRelative |
| 基类 | GTNHLib AbstractChatComponentNumber |
功能
聊天中的相对时间组件,正文显示「N 分钟前 / N 小时前」这类可读描述。
实现要点
formatNumber(Number)被标注为Client side call.—— 格式化发生在客户端, 服务端只传原始毫秒时间戳。- 走
TimeUtils.relativeTimeAgoFormatter(...)得到TimeUtils.DurationParts。 - 继承
AbstractChatComponentNumber(而非...Custom),说明它复用了 GTNHLib 的数字格式化管线。
相关条目
- ChatComponentTimeAbsolute - 绝对时间组件
- TimeUtils - 格式化实现
- TemporaChatRegistry - 注册处