0x02 S02PacketChat

Server sends a chat message or command response to the client.

Clientbound (Server → Client) · PLAY · net/minecraft/network/play/server/S02PacketChat.java

Published 2026-06-18 · Updated 2026-10-14

chatmessagecommand
Comprehensive 8/8

Fields

FieldTypeDescription
chatComponentIChatComponentThe chat message or command response
typebyte0 = chat box, 1 = system message (singleplayer), 2 = above hotbar

Wire Encoding

FieldTypeNotes
JSON DataChat ComponentThe chat message JSON
Positionbyte0=chat, 1=system, 2=actionbar

MCP References

MCPNetHandlerPlayClient.handleChat()

Handler Interface

HNDINetHandlerPlayClient

Notes

Position 0 shows in chat box. Position 2 shows above the hotbar (action bar).

Vanilla Source

S02PacketChat.java73 lines · MCP 1.8.9Original ↗
1
package net.minecraft.network.play.server;
2
3
import java.io.IOException;
4
import net.minecraft.network.Packet;
5
import net.minecraft.network.PacketBuffer;
6
import net.minecraft.network.play.INetHandlerPlayClient;
7
import net.minecraft.util.IChatComponent;
8
9
public class S02PacketChat implements Packet<INetHandlerPlayClient>
10
{
11
    private IChatComponent chatComponent;
12
    private byte type;
13
14
    public S02PacketChat()
15
    {
16
    }
17
18
    public S02PacketChat(IChatComponent component)
19
    {
20
        this(component, (byte)1);
21
    }
22
23
    public S02PacketChat(IChatComponent message, byte typeIn)
24
    {
25
        this.chatComponent = message;
26
        this.type = typeIn;
27
    }
28
29
    /**
30
     * Reads the raw packet data from the data stream.
31
     */
32
    public void readPacketData(PacketBuffer buf) throws IOException
33
    {
34
        this.chatComponent = buf.readChatComponent();
35
        this.type = buf.readByte();
36
    }
37
38
    /**
39
     * Writes the raw packet data to the data stream.
40
     */
41
    public void writePacketData(PacketBuffer buf) throws IOException
42
    {
43
        buf.writeChatComponent(this.chatComponent);
44
        buf.writeByte(this.type);
45
    }
46
47
    /**
48
     * Passes this Packet on to the NetHandler for processing.
49
     */
50
    public void processPacket(INetHandlerPlayClient handler)
51
    {
52
        handler.handleChat(this);
53
    }
54
55
    public IChatComponent getChatComponent()
56
    {
57
        return this.chatComponent;
58
    }
59
60
    public boolean isChat()
61
    {
62
        return this.type == 1 || this.type == 2;
63
    }
64
65
    /**
66
     * Returns the id of the area to display the text, 2 for above the action bar, anything else currently for the chat
67
     * window
68
     */
69
    public byte getType()
70
    {
71
        return this.type;
72
    }
73
}

Deobfuscated MCP 1.8.9 source of S02PacketChat, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/server/S02PacketChat.java) at build time and verified present.

Deep Dive

Role in the protocol

The single channel for every server-to-client message in the PLAY state: player chat, command output, kill feed, actionbar text, plugin announcements, and anti-cheat notices. The payload is a JSON ChatComponent plus a byte position (0 chat box, 1 system message, 2 actionbar above the hotbar). Vanilla routing is trivial: NetHandlerPlayClient.handleChat sends type 2 to the ingame GUI overlay and everything else to GuiNewChat.printChatMessage. Because every server plugin funnels text through it, it is the most-intercepted clientbound packet in the corpus: 25 non-vanilla file hits across 6 of the 8 clients.

Vanilla handling

handleChat runs PacketThreadUtil.checkThreadAndEnqueue, then branches on the position byte: if (packetIn.func_179841_c() == 2) this.gameController.ingameGUI.func_175188_a(component, false); else this.gameController.ingameGUI.getChatGUI().printChatMessage(component). The component is parsed leniently from JSON; malformed components degrade to plain text rather than disconnecting. Server-side, S02PacketChat is the delivery vehicle: ServerConfigurationManager.sendChatMsgImpl broadcasts it, EntityPlayerMP.addChatMessage sends it per player, and kick/actionbar paths construct it directly.

Why clients touch it

Six families in the corpus. Game-end and lobby automation: Sigma AutoGG, Rise 5.99 AutoHypixel, Rise 6.x AutoPlay (parse the kill feed and the /play click actions in the component's siblings). Staff and identity: Rise 5.99 StaffAlert (captures the Hypixel API key line), Sigma StreamerMode, Spicy HideName, Rise 5.99 Denicker, Rise 6.x Streamer (rewrite or cancel messages that contain the player's name). Kill-feed banter: Memeware DeathInsult, Spicy KillSults. Request automation: Sigma AutoTPA, Rise 5.99 FightBot and BedwarsTP, Tenacity TPKiller, Rise 6.x WatchdogAutoPhase. Auth: Rise 5.99 AutoAuthme reacts to auth-me prompt text. The rest of the field is heterogeneous: Rise Nuker, PlayerHacks, Phase, Disabler, Translator and Ranking, Rise 6.x APIKeyComponent, IRCInfoComponent, AdaptiveRefreshRateComponent (uses S02 as a frame-rate hint), LoggerRCECheck, and the Spicy meme modules. Nekoware v1 is the only client with zero module hits.

Exploit surface

The JSON component is attacker-controlled server text, and the Log4Shell era made that concrete: Rise 6.x ships LoggerRCECheck, a SecurityFeature that pattern-matches ${...} in the unformatted and formatted text of every S02PacketChat (and in S29 sound names) and blocks the packet before it reaches the logger. Beyond RCE, the component's click events carry runCommand actions, which AutoPlay extracts programmatically instead of waiting for a user click. Cancel-and-rerender name protection (StreamerMode) hides the player's name from the local log while the original packet never renders. DeathInsult appends a random hex suffix so message-spam filters cannot match the repeated insult string. Position matters: modules that must react to actionbar text (AutoPlay skips non-chat via isChat()) filter on the type byte.

Server-Side Handling

Server emission points: ServerConfigurationManager.sendChatMsgImpl builds S02PacketChat and broadcasts to all players; EntityPlayerMP.addChatMessage sends to one player; NetHandlerPlayServer wraps kick reasons and actionbar messages. Nothing validates the component server-side because the server is the author of it. The client parses it leniently; the only client-side failure mode is a giant JSON string approaching the 32767-byte String cap, which degrades to a truncated render.

Protocol Analysis

Wire layout: ChatComponent serialized as JSON (String, VarInt length + UTF-8), then a byte position (0 chat, 1 system/singleplayer, 2 actionbar). Components are trees: getFormattedText() includes color codes, getUnformattedText() strips them, getSiblings() exposes the child components where click actions (runCommand/suggestCommand) and hover events live. AutoPlay reads /play commands by splitting a sibling's toString() on quotes. Position 2 messages bypass the chat history and render above the hotbar; isChat() (type == 0) is the standard filter before pattern matching.

Anti-Cheat Landscape

No anti-cheat measures chat content or rate, but anti-cheat messages themselves are data for modules: Tenacity TPKiller and Rise 6.x WatchdogAutoPhase and Nuker read server notices from this packet to trigger or reset their behavior. Server-side, the same channel is the delivery path for ban/kick notices, so watchdog-style anti-cheats both emit through it and are blind to its client-side consumption. The only hard security boundary is injection: LoggerRCECheck exists because a ${...} payload inside a chat component could reach the logging pipeline; the pattern match on both text forms is the mitigation.

implementation Implementation Cases

The chat/actionbar delivery packet and the most-intercepted clientbound packet in the corpus. Six module families parse it: game-end automation, staff detection and name protection, kill-feed banter, request automation, auth-me login, and a long tail of utility and security components. Nekoware v1 alone has zero module hits.

AutoGG / AutoPlay / AutoHypixel (Sigma 4.11, Rise 5.99, Rise 6.1.30, Rise 6.2.4, November Recode 2.0)

Detect game-end or lobby prompts in chat and react automatically: send gg, queue the next game, or rejoin.

A PacketReceiveEvent listener instanceof-checks S02PacketChat, filters on position, and pattern-matches the component text. Rise 6.x AutoPlay skips non-chat positions via chat.isChat(), looks for a 'play again?' prompt, iterates getSiblings(), and extracts the /play command embedded in a click action by splitting the sibling's toString() on quotes, then sends it via ChatUtil.send. Sigma 4.11 AutoGG matches kill-feed lines and calls ChatUtil to send gg.

Source: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/other/AutoPlay.java

Vanilla hook: PacketReceiveEvent (Rise) / EventPacket with isIncoming (Sigma).
Sending a /play command within milliseconds of the game-end prompt is the only tell, and server-side it is indistinguishable from a fast human click. No anti-cheat flags chat automation.
Variations: Sigma 4.11 AutoGG matches '1st Killer -' / 'Winner:' style lines and sends gg; Rise 5.99 AutoHypixel reacts to lobby prompts; Rise 6.x AutoPlay extracts the exact /play string from the component's click action, which is more robust than pattern tables. November Recode 2.0's AutoPlayModule matches the exact 'You won! Want to play again? Click here!' and 'You died! Want to play again? Click here!' lines, walks getSiblings() for a RUN_COMMAND ClickEvent, stores the command, and sends it via addToSendQueueSilent after a configurable delay; a BLOCKS_MC mode swaps to a paper item instead of a chat command.
StaffAlert (Rise 5.99)

Track Hypixel staff bans by capturing the API key from chat and polling the punishment stats endpoint.

onPacketReceive scans every S02PacketChat: if the unformatted text starts with 'Your new API key is ', the key is stored and a chat message confirms it. Until the key is set, onUpdate sends /api new every 10 ticks on Hypixel. Once set, a timer thread polls https://api.hypixel.net/punishmentstats?key=... and fires notifications when staff_total increases.

Source: Rise 5.99, dev/rise/module/impl/other/StaffAlert.java

Vanilla hook: PacketReceiveEvent (S02PacketChat), UpdateEvent (polling and /api new), PacketUtil.sendPacket for the chat command.
Sending /api new every 10 ticks until the key arrives is chat-rate behavior only; Hypixel does not flag it. The HTTP polling happens off the game thread, so no tick overhead.
Variations: Rise 6.x moves API key capture into APIKeyComponent, a separate component that parses the same chat line, leaving StaffAlert-style polling out of the module tree.
StreamerMode / HideName / Denicker / Streamer (Sigma 4.11, Spicy, Rise 5.99, Rise 6.1.30, Rise 6.2.4)

Keep the player's name out of chat rendering: rewrite the component locally or cancel the packet entirely.

Sigma 4.11 StreamerMode: on incoming S02PacketChat with NAMEPROTECT enabled, if the unformatted text contains the player's name, it re-renders the message with the name replaced by a colored 'You' via ChatUtil.printChat and cancels the original; otherwise it cancels any message containing a word from a join/leave/death blacklist. Spicy HideName cancels chat packets that contain the player's name; Rise 5.99 Denicker and Rise 6.x Streamer do the same with their own component access.

Source: Sigma 4.11, info/sigmaclient/module/impl/other/StreamerMode.java

Vanilla hook: EventPacket with isIncoming() and EventUpdate (Sigma); Spicy uses its packetEvent inside Module onEnable/onDisable; Rise hooks PacketReceiveEvent.
Cancelling a chat packet is invisible to the server: the message was already delivered, the client just declines to render it. The risk is user-facing, not detection: legit messages get eaten by the blacklist.
Variations: Spicy HideName cancels only name-bearing packets; Rise 5.99 Denicker replaces the name with a generic string in the component before letting it render; Rise 6.x Streamer gates on a name toggle and casts the packet the same way.
KillSults / DeathInsult (Memeware 7.3, Spicy)

Reply to the kill feed with an insult when the player scores a kill.

Memeware DeathInsult matches seven kill-feed patterns on the unformatted text (killed by / slain by / void while escaping / magic while fighting / couldn't fly / fell to their death while escaping / Hypixel reward lines, plus a Spanish 'asesino ha' variant), then sends a random insult from a static table appended with a 12-character hex suffix via mc.thePlayer.sendChatMessage. Spicy KillSults runs the same idea on its own event bus with its own phrase table.

Source: Memeware 7.3, me/memewaredevs/client/module/misc/DeathInsult.java

Vanilla hook: PacketInEvent (Memeware's LWJEB event bus); Spicy uses its packetEvent handler.
The send rate is one message per kill, far below spam thresholds. The hex suffix exists to beat chat filters, not anti-cheats; nothing movement-related is involved.
Variations: Spicy KillSults lives in modules/memes with DougDimmadome, FloofyFoxes and Furries, which import S02PacketChat for the same receive-hook pattern; Spicy's Account.java also parses S02PacketChat for login handling.
AutoTPA / FightBot / BedwarsTP / TPKiller / WatchdogAutoPhase (Sigma 4.11, Rise 5.99, Rise 6.1.30, Rise 6.2.4, Tenacity 6.0)

Trigger a game action from a specific chat line: accept teleport and party requests, respond to kill messages, or react to anti-cheat checks.

Sigma AutoTPA matches 'has requested to teleport to you', 'has requested that you teleport to them', and party-invite lines on the formatted text, verifies the requester is in FriendManager.friendsList (name or alias), and sends /tpaccept or /party accept via ChatUtil.sendChat_NoFilter. Rise 5.99 FightBot and BedwarsTP parse kill/bed lines; Tenacity TPKiller reacts to anti-cheat or kill notices; Rise 6.x WatchdogAutoPhase watches for watchdog check messages to time a phase reset.

Source: Sigma 4.11, info/sigmaclient/module/impl/other/AutoTPA.java

Vanilla hook: EventPacket with isIncoming() (Sigma RegisterEvent); the other clients use their PacketReceiveEvent equivalents.
Auto-accepting a friend's TPA looks like an instant manual click; no anti-cheat measures it. The friend-list gate is the anti-abuse control: strangers cannot bait the module into sending commands.
Variations: Rise 5.99 FightBot (combat) and BedwarsTP (movement) parse their own pattern sets; Tenacity 6.0 TPKiller (exploit) reads kill/check messages; Rise 6.x WatchdogAutoPhase reads watchdog chat notices to reset phase timing. All share the instanceof + component-text read.
AutoAuthme (Rise 5.99)

Automate registration and login on auth-me servers by reacting to the server's prompt messages.

onPacketReceive scans S02PacketChat: if the unformatted text contains '/register' the module registers, if it contains '/login' it logs in. Register generates a random 8-char password, sends /register via sendChatMessage, schedules /login one second later on a static scheduled executor, and persists the per-server credentials to authmelogins.txt. The companion onPacketSend cancels the player's own /register and /login C01PacketChatMessage packets so nothing double-fires. State resets on WorldChangedEvent and GUI transitions.

Source: Rise 5.99, dev/rise/module/impl/other/AutoAuthme.java

Vanilla hook: PacketReceiveEvent (S02PacketChat prompts), PacketSendEvent (C01 cancellation), WorldChangedEvent and OpenGUIEvent (state reset).
Auth-me servers enforce no rate limit on login packets, so the one-second-delayed /login is indistinguishable from typing. The cancelled C01 packets never reach the server, so the server never sees the double-send.
Variations: No other client in the corpus implements auth automation on S02PacketChat; Rise 6.x drops the module entirely.
Phase (cage phase) (November Recode 2.0)

Gate the cage-phase exploit on S02 chat signals: enable phasing when the server announces the cage countdown, disable when the fight starts.

The EventPacket.In listener checks S02PacketChat; on BLOCKS_MC, unformatted text containing 'Cages open in: 2 seconds!' sets canPhase true, and 'Cages opened! FIGHT!' calls setState(false). The rest of the module removes the glass block under the player while cagePhasing and restores it on disable.

Source: November Recode 2.0, feature/module/impl/exploit/PhaseModule.java

Vanilla hook: EventPacket.In (S02PacketChat), EventPacket.Out (packet queue), EventUpdate (cage logic).
The chat gate makes the exploit self-timing: phasing only starts after the server's own announcement, so the window matches the server's expected transition rather than a fixed timer.
Variations: Tenacity TPKiller and Rise 6.x WatchdogAutoPhase are the other chat-triggered exploit modules, but November's is the only one tied to a cage-open announcement.
AntiBot (HytBedwars) (LiquidSense Dev)

Extract real player names from S02 kill-feed and chat lines on the Hyt (Chinese) BedWars server, so KillAura skips anti-cheat bots.

The HytBedwars branch of onPacket matches two regexes against the unformatted text: '杀死了 (.*?)\(' for kill feed and '> (.*?)\(' for chat names. Each captured name goes into the static playerName list for 6 seconds (a background thread removes it), and the entity check later exempts entities whose names are in the list.

Source: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/misc/AntiBot.java

Vanilla hook: PacketEvent (S02PacketChat), UpdateEvent, and entity checks on S14PacketEntity.
The kill-feed names are server-authored, so a bot list built from them inherits server trust; the 6-second expiry keeps the list from going stale mid-game.
Variations: No other client in the corpus mines S02 for bot whitelisting; the regexes are hardcoded for the Chinese server's kill-feed format.
PacketReceiveEvent / EventPacket(isIncoming) is universal across all 6 clients with hits. Components in Rise 6.x (APIKeyComponent, IRCInfoComponent, AdaptiveRefreshRateComponent, LoggerRCECheck) subscribe to the same receive pipeline as non-module listeners. November Recode 2.0 parses S02 in EventPacket.In (AutoPlayModule, PhaseModule); LiquidSense Dev parses it in PacketEvent (AntiBot).
Sigma reads the component via func_148915_c() (getChatComponent) and routes replies through ChatUtil.sendChat_NoFilter. Memeware and Spicy use their own LWJEB packet events and mutate nothing. Rise 5.99 reads chatComponent directly and uses event.setCancelled. Rise 6.x wraps S02PacketChat and uses isChat() plus getSiblings() for structured extraction. November Recode 2.0 reads the component via getUnformattedText() and sends replies with addToSendQueueSilent; LiquidSense Dev matches Chinese kill-feed patterns with Pattern/Matcher and maintains a timed static name list.

anticheat Anti-Cheat Checks

S02 is the outbound chat packet: anticheats send their own alerts through it, but they cannot see what the client renders, so none of them validate the packet's payload on the server side. The chat checks that exist in the corpus run on the INBOUND chat packet or Bukkit chat events and then talk back through S02: Grim flags blank tab-complete and impossible chat, NCP gates chat behind a captcha, Photon flags chat while sprinting or with an open inventory, and BetterAnticheat flags chat while chat is set to hidden. From the anticheat's point of view S02 is the delivery channel, not the input.

ChatA (Grim) (GrimAnticheat-Grim)

Flags blank or slash-only tab-complete packets, an exploit probe that accompanies chat-related client abuse.

Pre-Via listener on the inbound tab-complete packet: if the text is exactly a slash or trims to empty, the check flags and cancels the packet. This is the chat-domain check in Grim's corpus for S02 because the outbound chat packet is the visible counterpart; the detection itself happens on the client-to-server side.

Detects: Tab-complete spam and blank tab-complete exploitation attempts that usually target chat or command pipelines.

Source: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/chat/ChatA.java

Variations: Grim has no outbound-chat check at all; like every anticheat it only emits through S02.
Captcha (NoCheatPlus) (Updated-NoCheatPlus-NoCheatPlus)

Gates chat behind a generated captcha: players must answer correctly before chat is accepted, with kick actions on repeated failure.

On the inbound chat listener, a player flagged by other chat checks is sent a captcha question through the outbound chat channel (S02). The captcha check compares the player's next message to the generated code, increments tries and violation level on mismatch, re-sends the question, and executes the configured actions (up to kicking) once tries exceed the threshold.

Detects: Spam bots, chat flooders and automated chat abuse that cannot solve a text captcha.

Source: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/chat/Captcha.java

Variations: Grim and Photon detect impossible chat states instead of gating; NCP is the only corpus anticheat that actively gates the chat channel.
ImpossibleChat (Photon AntiCheatAddition) (Photon-GitHub-AntiCheatAddition)

Flags chat messages that a vanilla client could not physically send, because the player is sprinting, sneaking, blocking, dead or had an inventory open.

Listens to Bukkit's async chat event rather than the packet. If the user is sprinting, sneaking, blocking, dead, or has had an inventory open for over a second, the chat is impossible and the module flags with 25 violation points, cancelling the event at the configured violation level.

Detects: Chat-spoofing clients and macro bots that send chat while the real player state says chat is impossible.

Source: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/checks/impossiblechat/ImpossibleChat.java

Variations: BetterAnticheat HiddenChatCheck targets the HIDDEN chat-visibility setting instead of body state; both are impossible-chat detectors.
HiddenChatCheck (BetterAnticheat) (amnoah-BetterAnticheat)

Flags chat messages sent while the player's client settings declare chat visibility as hidden.

Tracks the chat-visibility value from inbound client settings (FULL, SYSTEM or HIDDEN). When a chat message arrives and the tracked visibility is HIDDEN, the check fails; the first occurrence is used as an initial-flag grace so settings that arrive late do not cause false positives.

Detects: Clients that send chat while the client settings say chat is disabled, which is impossible for a vanilla client.

Source: amnoah-BetterAnticheat, core/src/main/java/better/anticheat/core/check/impl/chat/HiddenChatCheck.java

Variations: Photon ImpossibleChat checks body state; BetterAnticheat checks the declared chat mode, the two complementary reads of the same impossibility.

Wiki Cross-Reference

Position 2 (above the hotbar action bar) is the overlay-style message, while position 0 goes to the chat box.

MCP 1.8.9 S02PacketChat implements Packet dispatching to INetHandlerPlayClient.handleChat; wire serde is readPacketData/writePacketData via readByte, readChatComponent.

1.8.9 callers: EntityPlayerMP.displayGUIChest sends new S02PacketChat (line 780) +2 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/player/EntityPlayerMP.java

Cross-checked against minecraft.wiki (CC BY-SA 3.0) for 1.8.9 accuracy.

Vanilla Internals

Full 1.8.9 logic-class sources that send or handle this packet, stored verbatim.