? ClientChat 系统 — 完整规范
? 概述
ClientChat 是一个 Minecraft 客户端通信系统,在游戏之上添加了全局和私人的消息传递层。
它允许使用相同模组的玩家:
通过外部后端跨服务器通信
创建私人聊天群组
发送私信
在服务器内广播全局消息
它不修改或替换 Minecraft 服务器的聊天功能,而是作为独立的通信网络并行运行。
所有通信均通过基于 WebSocket 的后端服务器处理,该服务器连接所有使用该模组的客户端。
⚙️ 核心功能
? 全局聊天系统
所有连接到同一服务器或网络会话的用户共享的聊天层。
? 私人聊天房间
玩家可以创建、加入和管理私人聊天群组。
? 私信
即时向特定玩家发送私人消息。
? 跨服务器通信
即使身处不同的 Minecraft 服务器(只要连接到后端),玩家之间也可以进行通信。
? 命令系统 (/chat)
所有功能都通过 /chat 命令访问。
? /chat <message>
➤ 全局服务器聊天消息
向连接到同一服务器会话的所有拥有 ClientChat 模组的玩家发送消息。
行为:
向所有已连接的客户端广播
在 Minecraft 聊天中以自定义格式显示
包含玩家名称前缀
示例:
/chat Hello everyone!
输出:
[Steve] Hello everyone!
? /chat create <room_name>
➤ 创建私人聊天房间
创建一个私人聊天房间。
行为:
玩家成为房间所有者
房间在后端服务器中注册
只有被邀请的用户才能加入
示例:
/chat create friends
? /chat invite <player>
➤ 邀请玩家加入当前房间
邀请玩家加入你当前所在的聊天房间。
行为:
通过后端发送邀请请求
玩家收到通知
玩家必须通过 /chat join 接受邀请
示例:
/chat invite Alex
? /chat join <room_name>
➤ 加入聊天房间
加入你已被邀请的房间。
行为:
后端验证邀请
如果有效 → 将玩家添加到房间
如果未被邀请 → 显示错误消息
示例:
/chat join friends
响应:
✅ 成功:已加入房间
❌ 错误:你未被邀请
? /chat leave
➤ 离开当前聊天房间
将玩家从当前活跃房间中移除。
行为:
玩家停止接收房间消息
返回到全局聊天模式
示例:
/chat leave
?️ /chat tell <player> <message>
➤ 私人私信
向特定玩家发送私人消息。
行为:
无论是否在房间内均可工作
玩家无需在同一服务器在线
消息高亮显示(例如黄色或特殊格式)
示例:
/chat tell Alex hey, where are you?
输出(接收者):
[DM] Steve → You: hey, where are you?
? /chat global <message>
➤ 强制全局广播
向当前服务器会话中的每个人发送消息,即使他们处于私人聊天房间内。
行为:
覆盖房间限制
在该服务器的所有已连接客户端可见
用于公告或紧急消息
示例:
/chat global Server restarting in 5 minutes!
? 系统规则
? 聊天模式
玩家始终处于以下状态之一:
? 全局模式
? 房间模式
? 无(默认回退)
? 权限逻辑
房间需要邀请才能加入
只有房间成员能接收房间消息
私信绕过所有限制
全局消息始终公开
? 消息流程
玩家输入 /chat 命令
客户端模组拦截命令
消息转换为 JSON 数据包
发送至 WebSocket 服务器
服务器处理逻辑(房间、邀请、路由)
服务器向正确的客户端广播
客户端在 Minecraft 聊天界面中显示消息
? 后端要求
该系统需要一个轻量级服务器:
基于 WebSocket(推荐)
处理:
已连接的玩家
房间
邀请
消息路由
没有这个后端,不同玩家之间的通信将无法工作。
? 聊天展示(客户端侧)
消息可以设置为如下样式:
? 全局:白色文本 + 玩家前缀
? 房间:彩色房间标签
? 私信:黄色高亮
? 全局覆盖:红色或加粗
示例:
[GLOBAL] Steve: Hello!
[FRIENDS] Alex: yo
[DM] Steve → Alex: hi
? 概念总结
ClientChat 是一个 Minecraft 社交通信层,具有:
客户端侧工作
通过外部服务器连接玩家
添加全局聊天、房间和私信
像 Minecraft 内的轻量级 Discord
? ClientChat System — Full Specification
? Overview
ClientChat is a Minecraft client-side communication system that adds a global and private messaging layer on top of the game.
It allows players using the same mod to:
communicate across servers (via external backend)
create private chat groups
send direct messages
broadcast messages globally within a server
It does not modify or replace Minecraft server chat, but runs alongside it as a separate communication network.
All communication is handled through a WebSocket-based backend server, which connects all clients using the mod.
⚙️ Core Features
? Global Chat System
A shared chat layer for all users connected to the same server or network session.
? Private Chat Rooms
Players can create, join, and manage private chat groups.
? Direct Messaging
Send private messages to specific players instantly.
? Cross-Server Communication
Players can communicate even while on different Minecraft servers (as long as they are connected to the backend).
? Command System (/chat)
All functionality is accessed through the /chat command.
? /chat <message>
➤ Global Server Chat Message
Sends a message to all players with the ClientChat mod connected to the same server session.
Behavior:
Broadcasts to all connected clients
Visible in Minecraft chat with custom formatting
Includes player name prefix
Example:
/chat Hello everyone!
Output:
[Steve] Hello everyone!
? /chat create <room_name>
➤ Create Private Chat Room
Creates a private chat room.
Behavior:
Player becomes the owner of the room
Room is registered in backend server
Only invited users can join
Example:
/chat create friends
? /chat invite <player>
➤ Invite Player to Current Room
Invites a player to the chat room you are currently in.
Behavior:
Sends invite request through backend
Player receives notification
Player must accept via /chat join
Example:
/chat invite Alex
? /chat join <room_name>
➤ Join a Chat Room
Joins a room you have been invited to.
Behavior:
Backend verifies invitation
If valid → adds player to room
If not invited → error message
Example:
/chat join friends
Responses:
✅ Success: Joined room
❌ Error: You are not invited
? /chat leave
➤ Leave Current Chat Room
Removes player from current active room.
Behavior:
Player stops receiving room messages
Returns to global chat mode
Example:
/chat leave
?️ /chat tell <player> <message>
➤ Private Direct Message
Sends a private message to a specific player.
Behavior:
Works regardless of rooms
Player does not need to be online in same server
Message highlighted (e.g. yellow or special format)
Example:
/chat tell Alex hey, where are you?
Output (receiver):
[DM] Steve → You: hey, where are you?
? /chat global <message>
➤ Force Global Broadcast
Sends a message to everyone in the current server session, even if inside a private chat room.
Behavior:
Overrides room restrictions
Visible to all connected clients in that server
Used for announcements or urgent messages
Example:
/chat global Server restarting in 5 minutes!
? System Rules
? Chat Modes
Players always exist in one of these states:
? Global mode
? Room mode
? None (default fallback)
? Permissions Logic
Rooms require invitation to join
Only room members receive room messages
Direct messages bypass all restrictions
Global messages are always public
? Message Flow
Player types /chat command
Client mod intercepts command
Message converted into JSON packet
Sent to WebSocket server
Server processes logic (rooms, invites, routing)
Server broadcasts to correct clients
Clients display message in Minecraft chat UI
? Backend Requirement
The system requires a lightweight server:
WebSocket-based (recommended)
Handles:
connected players
rooms
invitations
message routing
Without this backend, communication cannot work between different players.
? Chat Presentation (Client Side)
Messages can be styled as:
? Global: white text + player prefix
? Room: colored room tag
? DM: yellow highlight
? Global override: red or bold
Example:
[GLOBAL] Steve: Hello!
[FRIENDS] Alex: yo
[DM] Steve → Alex: hi
? Concept Summary
ClientChat is a Minecraft social communication layer that:
works client-side
connects players via external server
adds global chat, rooms, and DMs
behaves like a lightweight Discord inside Minecraft
评论 0
登录后参与评分
还没有评论,来抢沙发吧