Skip to content

PP: Chat Message #3

@JStalnac

Description

@JStalnac

Proposal for the Chat Message packet. Includes clientbound (S->C) and serverbound (C->S) versions.

The packet is used for sending messages in chat and displaying messages on the client, like in v0.75.
Notice that the message Content is encoded as UTF-8, not CP437. UTF-8 is easier to work with and it supports more characters.

Chat Message

Info ID
Packet ID: 17

(The ID can be changed, I just picked the one that is in v0.75)

Clientbound

Info Size
Total Size: 1 or 2 + Length of Content
Field Name Field Type Example Notes
Message type UByte 0 See table below
(Sender) UByte 0 The ID of the player who sent the message. Not included if type is not CHAT_ALL or CHAT_TEAM
Content String (UTF-8) Hello, client!

Serverbound

Info Size
Total Size: 1 + Length of Content
Field Name Field Type Example Notes
Message type UByte 0 Only CHAT_ALL and CHAT_TEAM message types are allowed to be sent by client. See table below
Content String (UTF-8) Hello, server!

Message types supported by the protocol (see here for explanation):

Value Type
0 CHAT_ALL
1 CHAT_TEAM
2 CHAT_SYSTEM
3 CHAT_BIG
4 CHAT_INFO
5 CHAT_WARNING
6 CHAT_ERROR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions