ChTR

ChTR

用于全局和本地聊天的简单模组

社交

一个支持两种模式的聊天模组:

  • 通过前缀触发的全局聊天(默认:!)
  • 按半径范围生效的本地聊天(默认:100 格)

如果本地消息发送时范围内没有任何人,发送者会收到警告。

兼容性

  • Minecraft:1.21.1
  • NeoForge:21.1.222+
  • Java:21

客户端无需安装此模组:所有聊天逻辑均在服务端运行。

工作原理

  • 以 globalPrefix 开头的消息会发送给所有玩家。
  • 普通消息仅发送给同一维度内 localChatRadius 范围内的玩家。
  • 如果没有听众,可以选择显示警告(warnIfNoListeners)。

配置(config/chatter-common.toml)

可用设置:

  • globalPrefix 全局聊天前缀。默认:"!"

  • localChatRadius 本地聊天半径(单位:格)。默认:100.0

  • globalMessageFormat 全局消息格式。 默认:"&6[G] <{player}> {message}"

  • localMessageFormat 本地消息格式。 默认:"&7[L] <{player}> {message}"

  • emptyGlobalMessage 当使用 globalPrefix 但未输入文本时显示的消息。 默认:"&cYou must type message text after {prefix}."

  • noListenersMessage 当没有人听到本地消息时显示的警告。 默认:"&cNobody heard you within {radius} blocks."

  • echoLocalToSender 是否向发送者显示本地消息。 默认:true

  • warnIfNoListeners 当本地消息没有听众时是否显示警告。 默认:true

占位符

格式和警告消息中支持:

  • {player} - 玩家名称
  • {message} - 消息文本
  • {radius} - 当前本地聊天半径
  • {prefix} - 当前全局聊天前缀
  • {listeners} - 听众数量

颜色与样式

支持的 & 格式代码:

  • 颜色:&0..&9、&a..&f
  • 样式:&l、&o、&n、&m、&k
  • 重置:&r
  • 字面量 &:&&

配置示例

globalPrefix = "!"
localChatRadius = 120.0
globalMessageFormat = "&6[GLOBAL] &f<{player}> &e{message}"
localMessageFormat = "&7[LOCAL {radius}] &f<{player}> {message}"
emptyGlobalMessage = "&cYou must type text after {prefix}."
noListenersMessage = "&cNobody heard you ({radius} blocks)."
echoLocalToSender = true
warnIfNoListeners = true