0x3F S3FPacketCustomPayload
Sends a plugin channel message from server to client. Used for mod/plugin communication.
Published 2026-06-18 · Updated 2026-10-14
Fields
| Field | Type | Description |
|---|---|---|
| channel | String | Plugin channel name |
| data | PacketBuffer | Channel-specific payload |
Wire Encoding
| Field | Type | Notes |
|---|---|---|
| Channel | String | Plugin channel identifier |
| Data Length | short | |
| Data | byte[] | Channel-specific payload |
MCP References
NetHandlerPlayClient.handleCustomPayload()Handler Interface
INetHandlerPlayClientNotes
Vanilla Source
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
Deobfuscated MCP 1.8.9 source of S3FPacketCustomPayload, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/server/S3FPacketCustomPayload.java) at build time and verified present.
Deep Dive
Role in the protocol
The clientbound plugin message. A channel name string (20-char cap) plus a raw PacketBuffer payload capped at 1048576 bytes. Vanilla channels include MC|Brand (server brand, sent once at join), MC|TrList (villager trades), MC|BOpen (book opening), and MC|AdvCmd (command block updates). handleCustomPayload dispatches by channel name; unknown channels are ignored. This is the standard bus for server-to-client mod and plugin communication.
Vanilla handling
handleCustomPayload branches on the channel: MC|TrList decodes the merchant recipe list into the open GuiMerchant, MC|Brand stores the brand string on the player, MC|BOpen opens the written-book GUI. The buffer is released in a finally block. Channel length is capped at 20 and the payload at 1MB, with an IOException on overflow.
Why clients touch it
Rise 5.99 PacketDebugger logs the channel name of every S3FPacketCustomPayload to chat via Rise.addChatMessage, as part of anti-cheat fingerprinting: the module also times keepalives and transactions. Reading MC|Brand is the standard server-identity read: brand strings identify Paper, Purpur, BungeeCord, and plugin stacks before a bypass picks a mode. Rise 6.x registers the class in the script API. The dedicated BrandDetector modules of the wider ecosystem (Flux, Lycoris) sit outside this corpus, so PacketDebugger is the only real consumer here.
Exploit surface
Purely observational. The payload is server-controlled; a malicious server can send oversized or malformed payloads, but the 1MB cap and try/finally release keep the vanilla path safe. Clients read the channel and payload for fingerprinting, and nothing is sent back, so servers cannot detect the read. The detection value is the brand string itself, which identifies the server stack before a disabler selects a mode.
Server-Side Handling
ServerConfigurationManager sends MC|Brand once per join with the server mod name. EntityPlayerMP sends MC|TrList when a player opens a merchant and MC|BOpen when opening a written book. The channel table is per-connection; the vanilla client only receives S3F and never echoes it. The wire payload length is the remaining readable bytes, capped at 1MB.
Protocol Analysis
readPacketData reads the channel (20-char cap), then takes the remaining readable bytes as the payload buffer, rejecting anything over 1048576 bytes with an IOException. writePacketData writes the channel then the raw buffer bytes. The payload is channel-specific; parsers must know the channel before reading fields from the buffer.
Anti-Cheat Landscape
Passive surface. The brand and channel names fingerprint the server stack; anti-cheats that send their own channels (version checks, telemetry) leak their presence through this packet. Clients never echo S3F, so the read is undetectable server-side. No anti-cheat in the corpus flags the packet itself.
implementation Implementation Cases
The clientbound plugin channel. Rise 5.99's PacketDebugger logs every channel name to chat for anti-cheat fingerprinting, and the MC|Brand channel is the standard server-identity read. Rise 6.x only registers the class in its script API.
Fingerprint the server's anti-cheat and network behavior by logging plugin channels and packet timing to chat.
onPacketSend logs C0FPacketConfirmTransaction window id and uid with inter-arrival milliseconds, C00PacketKeepAlive key with inter-arrival milliseconds, and S3FPacketCustomPayload channel name via Rise.addChatMessage. The S3F branch catches clientbound payloads as they pass through the event.
// ===== FILE: Rise 5.99, dev/rise/module/impl/other/PacketDebugger.java =====
/*
Copyright Alan Wood 2021
None of this code to be reused without my written permission
Intellectual Rights owned by Alan Wood
*/
package dev.rise.module.impl.other;
import dev.rise.Rise;
import dev.rise.event.impl.packet.PacketSendEvent;
import dev.rise.module.Module;
import dev.rise.module.api.ModuleInfo;
import dev.rise.module.enums.Category;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C00PacketKeepAlive;
import net.minecraft.network.play.client.C0FPacketConfirmTransaction;
import net.minecraft.network.play.server.S3FPacketCustomPayload;
@ModuleInfo(name = "PacketDebugger", description = "Debugger for detecting anticheats", category = Category.OTHER)
public final class PacketDebugger extends Module {
private long lastKeepAlive;
private long lastTransaction;
@Override
public void onPacketSend(PacketSendEvent event) {
Packet p = event.getPacket();
if (p instanceof C0FPacketConfirmTransaction) {
long lastPacket = System.currentTimeMillis() - lastTransaction;
Rise.addChatMessage("Transaction: " + ((C0FPacketConfirmTransaction) event.getPacket()).getWindowId()
+ " " + ((C0FPacketConfirmTransaction) event.getPacket()).getUid() + " " + lastPacket + "ms");
this.lastTransaction = System.currentTimeMillis();
} else if (p instanceof C00PacketKeepAlive) {
long lastPacket = System.currentTimeMillis() - lastKeepAlive;
Rise.addChatMessage("KeepAlive: " + ((C00PacketKeepAlive) event.getPacket()).getKey() + " " + lastPacket + "ms");
this.lastKeepAlive = System.currentTimeMillis();
} else if (p instanceof S3FPacketCustomPayload) {
Rise.addChatMessage("Payload: " + ((S3FPacketCustomPayload) event.getPacket()).getChannelName());
}
}
}
// NOTE (AI): The S3FPacketCustomPayload branch on lines 37-38 prints the channel name to chat. The module's primary output is keepalive and transaction timing, which reveals how the server handles the two packets that ping-spoof and disabler modes rely on.Expose the packet class to Rise's JavaScript scripting API.
S3FPacketCustomPayload is listed in the clientbound Class array of NetworkAPI.java (line 106).
// ===== FILE: Rise 6.1.30, com/alan/clients/script/api/NetworkAPI.java =====
package com.alan.clients.script.api;
import com.alan.clients.util.chat.ChatUtil;
import lombok.SneakyThrows;
import net.minecraft.network.EnumPacketDirection;
import net.minecraft.network.Packet;
import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraft.network.play.INetHandlerPlayServer;
import net.minecraft.network.play.client.*;
import net.minecraft.network.play.server.*;
import javax.script.ScriptException;
import java.util.Arrays;
public class NetworkAPI extends API {
public final static Class<Packet<INetHandlerPlayServer>>[] serverbound = new Class[]{
C00PacketKeepAlive.class,
C01PacketChatMessage.class,
C02PacketUseEntity.class,
C03PacketPlayer.class,
C03PacketPlayer.C04PacketPlayerPosition.class,
C03PacketPlayer.C05PacketPlayerLook.class,
C03PacketPlayer.C06PacketPlayerPosLook.class,
C07PacketPlayerDigging.class,
C08PacketPlayerBlockPlacement.class,
C09PacketHeldItemChange.class,
C0APacketAnimation.class,
C0BPacketEntityAction.class,
C0CPacketInput.class,
C0DPacketCloseWindow.class,
C0EPacketClickWindow.class,
C0FPacketConfirmTransaction.class,
C10PacketCreativeInventoryAction.class,
C11PacketEnchantItem.class,
C12PacketUpdateSign.class,
C13PacketPlayerAbilities.class,
C14PacketTabComplete.class,
C15PacketClientSettings.class,
C16PacketClientStatus.class,
C17PacketCustomPayload.class,
C18PacketSpectate.class,
C19PacketResourcePackStatus.class,
};
public final static Class<Packet<INetHandlerPlayClient>>[] clientbound = new Class[]{
S00PacketKeepAlive.class,
S01PacketJoinGame.class,
S02PacketChat.class,
S03PacketTimeUpdate.class,
S04PacketEntityEquipment.class,
S05PacketSpawnPosition.class,
S06PacketUpdateHealth.class,
S07PacketRespawn.class,
S08PacketPlayerPosLook.class,
S09PacketHeldItemChange.class,
S0APacketUseBed.class,
S0BPacketAnimation.class,
S0CPacketSpawnPlayer.class,
S0DPacketCollectItem.class,
S0EPacketSpawnObject.class,
S0FPacketSpawnMob.class,
S10PacketSpawnPainting.class,
S11PacketSpawnExperienceOrb.class,
S12PacketEntityVelocity.class,
S13PacketDestroyEntities.class,
S14PacketEntity.class,
S18PacketEntityTeleport.class,
S19PacketEntityHeadLook.class,
S19PacketEntityStatus.class,
S1BPacketEntityAttach.class,
S1CPacketEntityMetadata.class,
S1DPacketEntityEffect.class,
S1EPacketRemoveEntityEffect.class,
S1FPacketSetExperience.class,
S20PacketEntityProperties.class,
S21PacketChunkData.class,
S22PacketMultiBlockChange.class,
S23PacketBlockChange.class,
S24PacketBlockAction.class,
S25PacketBlockBreakAnim.class,
S26PacketMapChunkBulk.class,
S27PacketExplosion.class,
S28PacketEffect.class,
S29PacketSoundEffect.class,
S2APacketParticles.class,
S2BPacketChangeGameState.class,
S2CPacketSpawnGlobalEntity.class,
S2DPacketOpenWindow.class,
S2EPacketCloseWindow.class,
S2FPacketSetSlot.class,
S30PacketWindowItems.class,
S31PacketWindowProperty.class,
S32PacketConfirmTransaction.class,
S33PacketUpdateSign.class,
S34PacketMaps.class,
S35PacketUpdateTileEntity.class,
S36PacketSignEditorOpen.class,
S37PacketStatistics.class,
S38PacketPlayerListItem.class,
S39PacketPlayerAbilities.class,
S3APacketTabComplete.class,
S3BPacketScoreboardObjective.class,
S3CPacketUpdateScore.class,
S3DPacketDisplayScoreboard.class,
S3EPacketTeams.class,
S3FPacketCustomPayload.class,
S40PacketDisconnect.class,
S41PacketServerDifficulty.class,
S42PacketCombatEvent.class,
S43PacketCamera.class,
S44PacketWorldBorder.class,
S45PacketTitle.class,
S46PacketSetCompressionLevel.class,
S47PacketPlayerListHeaderFooter.class,
S48PacketResourcePackSend.class,
S49PacketUpdateEntityNBT.class
};
@SneakyThrows
private static Packet<?> instantiatePacket(final EnumPacketDirection direction, final int id, final Object... params) {
Packet<?> packet = null;
try {
if (direction == EnumPacketDirection.CLIENTBOUND) {
packet = (Packet<?>) Arrays.stream(clientbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);
} else if (direction == EnumPacketDirection.SERVERBOUND) {
packet = (Packet<?>) Arrays.stream(serverbound[id].getConstructors()).filter(x -> x.getParameterCount() == params.length).findFirst().get().newInstance(params);
}
} catch (Exception ex) {
ChatUtil.display("Failed to instantiate packet!");
throw new ScriptException(ex);
}
return packet;
}
public void sendPacket(final int id, final Object... params) {
final Packet<?> packet = instantiatePacket(EnumPacketDirection.SERVERBOUND, id, params);
MC.getNetHandler().addToSendQueue(packet);
}
public void receivePacket(final int id, final Object... params) {
final Packet<?> packet = instantiatePacket(EnumPacketDirection.CLIENTBOUND, id, params);
MC.getNetHandler().addToReceiveQueue(packet);
}
public boolean isSingleplayer() {
return MC.isSingleplayer();
}
public boolean isMultiplayer() {
return !MC.isSingleplayer() && MC.getCurrentServerData() != null;
}
public String getServerIP() {
return MC.getCurrentServerData() != null
? MC.getCurrentServerData().serverIP
: null;
}
public String getServerName() {
return MC.getCurrentServerData() != null
? MC.getCurrentServerData().serverName
: null;
}
public String getServerMOTD() {
return MC.getCurrentServerData() != null
? MC.getCurrentServerData().serverMOTD
: null;
}
}
// NOTE (AI): The clientbound array lists S3FPacketCustomPayload at line 106. Identical file ships in Rise 6.2.4 under Client-release2/Client/src/main/java.anticheat Anti-Cheat Checks
S3F is the outbound plugin channel, and the corpus splits by direction. The inbound machinery dominates the keyword matches: brand recognition (Grim ClientBrand, Shard ClientBrand, Truthful BrandListener, Photon BrandChannelData, intave PayloadInReader and SettingsTracker, LightAntiCheat ClientBrandRecognizer), payload frequency (Arc PayloadFrequency), payload exploits (Grim ExploitA and ExploitB), and badpackets (Frequency BadPacketsD, Hydro BadPacketsC, FlopAC BadPacketsF and BadPacketsG) all consume the client-to-server payload and appear here because the search terms overlap. The genuine S3F consumers are the anticheats' own outbound payloads: Photon rewrites the outgoing brand so clients cannot fingerprint the server, intave emits a brand-channel mark to authenticate its companion client, and Negativity sends FML handshake probes to enumerate Forge mods. Artemis and Negativity register the packet classes (SERVER_PLAY+21, CUSTOM_PAYLOAD_IN and CUSTOM_PAYLOAD_OUT).
Stop clients from fingerprinting the server: rewrite every outbound brand payload to a configured fake brand.
Two PacketAdapterBuilder listeners hook the outbound PLUGIN_MESSAGE packets (Configuration.Server and Play.Server, the S3F path) with onSendingRaw. When the channel is the brand channel (MC|Brand or minecraft:brand), the payload data is replaced with createBrandPayload of the configured brand ('Some Spigot' by default) and the packet is marked for re-encode. On join, and at an optional refresh rate, the module also pushes an empty brand payload so the adapter has something to rewrite.
// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/additions/BrandHider.java =====
package de.photon.anticheataddition.modules.additions;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.event.PacketListener;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.configuration.server.WrapperConfigServerPluginMessage;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPluginMessage;
import de.photon.anticheataddition.AntiCheatAddition;
import de.photon.anticheataddition.modules.Module;
import de.photon.anticheataddition.modules.ModuleLoader;
import de.photon.anticheataddition.util.execute.Placeholders;
import de.photon.anticheataddition.util.log.Log;
import de.photon.anticheataddition.util.pluginmessage.ByteBufUtil;
import de.photon.anticheataddition.util.pluginmessage.MessageChannel;
import de.photon.anticheataddition.util.protocol.PacketAdapterBuilder;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.scheduler.BukkitTask;
public final class BrandHider extends Module implements PacketListener, Listener {
public static final BrandHider INSTANCE = new BrandHider();
private String brand;
private final String channel = MessageChannel.MC_BRAND_CHANNEL.getChannel().orElseThrow();
private BukkitTask updateTask;
private BrandHider()
{
super("BrandHider");
}
public void setBrand(String brand)
{
this.brand = ChatColor.translateAlternateColorCodes('&', brand) + ChatColor.RESET;
this.updateAllBrands();
}
private void updateAllBrands()
{
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) updateBrand(onlinePlayer);
}
private void updateBrand(final Player player)
{
// Just send an empty brand message, as this will be replaced by the Packet Adapter below anyways.
final byte[] payload = createBrandPayload("");
PacketEvents.getAPI().getPlayerManager().sendPacket(player, new WrapperPlayServerPluginMessage(this.channel, payload));
}
private static byte[] createBrandPayload(final String brand)
{
final ByteBuf buf = Unpooled.buffer();
try {
ByteBufUtil.writeString(buf, brand);
return ByteBufUtil.toArray(buf);
} finally {
buf.release();
}
}
@EventHandler
public void onJoin(final PlayerJoinEvent event)
{
updateBrand(event.getPlayer());
}
@Override
public void enable()
{
Log.finer(() -> "BrandHider brand " + this.brand + " | channel " + this.channel);
this.setBrand(loadString(".brand", "Some Spigot"));
final long refreshRate = loadLong(".refresh_rate", 0);
if (refreshRate > 0) {
this.updateTask = Bukkit.getScheduler().runTaskTimer(AntiCheatAddition.getInstance(), this::updateAllBrands, 20L, refreshRate);
}
}
@Override
public void disable()
{
if (this.updateTask != null) this.updateTask.cancel();
}
@Override
protected ModuleLoader createModuleLoader()
{
return ModuleLoader.builder(this)
//
.addPacketListeners(
// For Configuration.Server, the player might still be null, as they are currently being constructed.
PacketAdapterBuilder.of(this, PacketType.Configuration.Server.PLUGIN_MESSAGE).onSendingRaw((event) -> {
final WrapperConfigServerPluginMessage packet = new WrapperConfigServerPluginMessage(event);
final String channel = packet.getChannelName();
Log.finer(() -> "BrandHider got PLUGIN_MESSAGE in channel " + channel + " | equals: " + this.channel.equals(channel));
if (this.channel.equals(channel)) {
// Only replace non-player placeholders
final String brand = Placeholders.replacePlaceholdersSafely(this.brand);
packet.setData(createBrandPayload(brand));
event.markForReEncode(true);
}
}).build(),
// For Play.Server, the player is already fully initialized on the server, so non-null.
PacketAdapterBuilder.of(this, PacketType.Play.Server.PLUGIN_MESSAGE).onSendingRaw((event) -> {
final WrapperPlayServerPluginMessage packet = new WrapperPlayServerPluginMessage(event);
final String channel = packet.getChannelName();
Log.finer(() -> "BrandHider got PLUGIN_MESSAGE in channel " + channel + " | equals: " + this.channel.equals(channel));
if (this.channel.equals(channel)) {
// Replace all placeholders.
final String brand = Placeholders.replacePlaceholders(this.brand, event.getPlayer());
packet.setData(createBrandPayload(brand));
event.markForReEncode(true);
}
}).build()).build();
}
}
// NOTE (AI): The Play.Server branch (lines 111-122) is the S3F consumer; the Configuration.Server branch covers the 1.20.2+ config phase. The module also pushes an empty S3F brand on join (lines 49-54) and on the refresh timer.Mark the server for the Intave companion client: emit an S3F brand payload carrying the Intave identifier so the Sibyl client can authenticate.
On join, and again on every restart broadcast and whenever a player is not yet authenticated, the service calls authentication.sendMessageToClient(player, 'MC|Brand', 'INTAVE', null), which writes the payload into an outbound custom payload packet (SibylAuthentication.java builds the ProtocolLib container around line 251). The companion client recognizes the mark and replies over its own channel.
// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/connect/sibyl/SibylIntegrationService.java =====
package de.jpx3.intave.connect.sibyl;
import de.jpx3.intave.IntaveControl;
import de.jpx3.intave.IntavePlugin;
import de.jpx3.intave.annotate.HighOrderService;
import de.jpx3.intave.cleanup.GarbageCollector;
import de.jpx3.intave.connect.sibyl.auth.SibylAuthentication;
import de.jpx3.intave.connect.sibyl.data.SibylPacketReceiver;
import de.jpx3.intave.connect.sibyl.data.SibylPacketTransmitter;
import de.jpx3.intave.connect.sibyl.data.packet.*;
import de.jpx3.intave.executor.Synchronizer;
import de.jpx3.intave.module.linker.bukkit.BukkitEventSubscriber;
import de.jpx3.intave.module.linker.bukkit.BukkitEventSubscription;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerJoinEvent;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import java.security.Key;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.function.Consumer;
@HighOrderService
public final class SibylIntegrationService implements BukkitEventSubscriber {
private final IntavePlugin plugin;
private final SibylAuthentication authentication;
private final SibylPacketTransmitter packetTransmitter;
private final SibylPacketReceiver packetReceiver;
public static final Set<UUID> ID_RECORDER = new HashSet<>();
private static final KeyPair globalKeyPair;
private static final byte[] verifyToken;
private static final Map<UUID, Key> KEYS = GarbageCollector.watch(new HashMap<>());
static {
KeyPair keyPair;
try {
KeyPairGenerator keypairgenerator = KeyPairGenerator.getInstance("RSA");
keypairgenerator.initialize(1024);
keyPair = keypairgenerator.generateKeyPair();
} catch (NoSuchAlgorithmException ignored) {
keyPair = null;
}
globalKeyPair = keyPair;
verifyToken = new byte[16];
ThreadLocalRandom.current().nextBytes(verifyToken);
}
public SibylIntegrationService(IntavePlugin plugin) {
this.plugin = plugin;
List<Consumer<UUID>> subscribers = new ArrayList<>();
subscribers.add(this::afterAuthentication);
this.authentication = new SibylAuthentication(plugin, subscribers);
this.packetTransmitter = new SibylPacketTransmitter(authentication, this);
this.packetReceiver = new SibylPacketReceiver(plugin, this);
this.plugin.eventLinker().registerEventsIn(this);
broadcastRestart();
}
private void afterAuthentication(UUID id) {
Player player = Bukkit.getPlayer(id);
if (player == null) {
return;
}
if (encryptionAvailable()) {
packetTransmitter.transmitPacket(player, new SibylPacketOutBeginEncryption(globalKeyPair.getPublic(), verifyToken));
}
}
public void confirmEncryption(Player player, SibylPacketInConfirmEncryption packet) {
if (!encryptionAvailable()) {
return;
}
if (!Arrays.equals(decryptRSA(packet.encryptedVerifyToken()), verifyToken)) {
if (IntaveControl.SIBYL_DEBUG) {
System.out.println("Sibyl: Invalid verify token for " + player.getName());
}
return;
}
byte[] keyBytes = decryptRSA(packet.encryptedSharedSecret());
if (keyBytes != null) {
try {
KEYS.put(player.getUniqueId(), new SecretKeySpec(keyBytes, "AES"));
} catch (Exception exception) {
exception.printStackTrace();
Synchronizer.synchronize(() -> {
player.kickPlayer(ChatColor.RED + "Error authenticating");
});
}
}
}
private static byte[] decryptRSA(byte[] data) {
try {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, globalKeyPair.getPrivate());
return cipher.doFinal(data);
} catch (Exception exception) {
exception.printStackTrace();
return null;
}
}
public boolean encryptionActiveFor(Player player) {
return KEYS.containsKey(player.getUniqueId());
}
private void broadcastRestart() {
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
authentication.sendMessageToClient(onlinePlayer, "MC|Brand", "INTAVE", null);
}
}
@BukkitEventSubscription
public void on(PlayerJoinEvent join) {
Synchronizer.synchronizeDelayed(() -> authenticatePlayer(join.getPlayer()), 20);
ID_RECORDER.add(join.getPlayer().getUniqueId());
if (ID_RECORDER.size() > 10000) {
ID_RECORDER.clear();
}
}
public void authenticatePlayer(Player player) {
if (!authentication.isAuthenticated(player)) {
authentication.sendMessageToClient(player, "MC|Brand", "INTAVE", null);
}
}
public static KeyPair globalKeyPair() {
return globalKeyPair;
}
public static byte[] verifyToken() {
return verifyToken;
}
public static boolean encryptionAvailable() {
return globalKeyPair != null && verifyToken != null;
}
public void publishAttackCancel(Player attacker, Entity attacked, boolean damage) {
SibylPacketOutAttackCancel packet = new SibylPacketOutAttackCancel();
packet.setAttacker(attacker.getUniqueId());
packet.setAttackedLocation(attacked.getLocation().toVector());
packet.setDamage(damage);
broadcastTrustedPacket(packet);
}
public void publishDebug(Player player, int id, String fullMessage, String shortMessage) {
SibylPacketOutDebug packet = new SibylPacketOutDebug();
packet.setDebugId(id);
packet.setFullMessage(fullMessage);
packet.setShortMessage(shortMessage);
sendTrustedPacket(player, packet);
}
public void broadcastTrustedPacket(SibylPacket packet) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (authentication.isAuthenticated(player)) {
packetTransmitter.transmitPacket(player, packet);
}
}
}
public void sendTrustedPacket(Player player, SibylPacket packet) {
if (!Bukkit.isPrimaryThread()) {
Synchronizer.synchronize(() -> sendTrustedPacket(player, packet));
return;
}
if (authentication.isAuthenticated(player)) {
packetTransmitter.transmitPacket(player, packet);
}
}
public SibylPacketTransmitter packetTransmitter() {
return packetTransmitter;
}
public SibylAuthentication authentication() {
return authentication;
}
public boolean isAuthenticated(Player user) {
return authentication.isAuthenticated(user);
}
public Key keyOf(Player player) {
return KEYS.get(player.getUniqueId());
}
}
// NOTE (AI): The S3F emission is sendMessageToClient at lines 117 and 132; the ProtocolLib packet construction lives in SibylAuthentication.buildAuthenticationPacket.Detect Forge clients by sending FML handshake payloads and reading the mod-list reply.
initMods sends three FML|HS plugin messages (bytes {-2,0}, {0,2,0,0,0,0} and {2,0,0,0,0}) to the player when the outgoing FML channel is registered, the standard FML handshake sequence that makes Forge reply with its mod list. ChannelEvents handles the incoming FML data (the C17 side) and stores the result in the player's mod map, which feeds the mod-based cheat checks.
// ===== FILE: Elikill58-Negativity, src/com/elikill58/negativity/spigot/SpigotNegativityPlayer.java =====
package com.elikill58.negativity.spigot;
import java.io.File;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.entity.Damageable;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.IronGolem;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.plugin.Plugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitTask;
import com.elikill58.negativity.spigot.inventories.AbstractInventory;
import com.elikill58.negativity.spigot.inventories.AbstractInventory.InventoryType;
import com.elikill58.negativity.spigot.inventories.holders.CheckMenuHolder;
import com.elikill58.negativity.spigot.listeners.PlayerCheatAlertEvent;
import com.elikill58.negativity.spigot.listeners.PlayerPacketsClearEvent;
import com.elikill58.negativity.spigot.protocols.InventoryMoveProtocol.InventoryMoveData;
import com.elikill58.negativity.spigot.support.FloodGateSupportManager;
import com.elikill58.negativity.spigot.support.GadgetMenuSupport;
import com.elikill58.negativity.spigot.support.ProtocolSupportSupport;
import com.elikill58.negativity.spigot.support.ViaVersionSupport;
import com.elikill58.negativity.spigot.utils.HandUtils;
import com.elikill58.negativity.spigot.utils.Utils;
import com.elikill58.negativity.universal.Cheat;
import com.elikill58.negativity.universal.Cheat.CheatCategory;
import com.elikill58.negativity.universal.Cheat.CheatHover;
import com.elikill58.negativity.universal.FlyingReason;
import com.elikill58.negativity.universal.NegativityAccount;
import com.elikill58.negativity.universal.NegativityAccountManager;
import com.elikill58.negativity.universal.NegativityPlayer;
import com.elikill58.negativity.universal.PacketType;
import com.elikill58.negativity.universal.ReportType;
import com.elikill58.negativity.universal.SimpleAccountManager;
import com.elikill58.negativity.universal.Version;
import com.elikill58.negativity.universal.adapter.Adapter;
import com.elikill58.negativity.universal.permissions.Perm;
import com.elikill58.negativity.universal.utils.UniversalUtils;
public class SpigotNegativityPlayer extends NegativityPlayer {
private static final Map<UUID, SpigotNegativityPlayer> players = new HashMap<>();
public static ArrayList<UUID> INJECTED = new ArrayList<>();
public HashMap<PacketType, Integer> PACKETS = new HashMap<>();
public HashMap<String, String> MODS = new HashMap<>();
public HashMap<String, Double> contentDouble = new HashMap<>();
public HashMap<String, Boolean> contentBoolean = new HashMap<>();
public HashMap<String, Integer> contentInts = new HashMap<>();
public HashMap<Cheat, List<PlayerCheatAlertEvent>> ALERT_NOT_SHOWED = new HashMap<>();
public ArrayList<PotionEffect> POTION_EFFECTS = new ArrayList<>();
public ArrayList<Integer> TIMER_COUNT = new ArrayList<>();
public ArrayList<Double> flyMoveAmount = new ArrayList<>();
private WeakReference<Player> p;
// Packets
public int ALL = 0, MAX_FLYING;
// warns & other
public int LAST_CLICK = 0, ACTUAL_CLICK = 0, SEC_ACTIVE = 0, SPIDER_SAME_DIST = 0, LAST_PING = -1;
// setBack
public int NO_FALL_DAMAGE = 0, BYPASS_SPEED = 0, LAST_SLOT_CLICK = -1, LAST_CHAT_MESSAGE_NB = 0, SPEED_NB = 0;
public double lastYDiff = -3.141592654;
public long TIME_INVINCIBILITY = 0, LAST_SHOT_BOW = 0, LAST_REGEN = 0, TIME_LAST_MESSAGE = 0, LAST_CLICK_INV = 0, LAST_BLOCK_PLACE = 0, TIME_REPORT = 0, LAST_BLOCK_BREAK = 0,
TIME_INVINCIBILITY_SPEED = 0, lastAlertCommandRan = 0;
public String LAST_CHAT_MESSAGE = "";
public boolean IS_LAST_SEC_SNEAK = false, isFreeze = false, isInvisible = false, isUsingSlimeBlock = false, isJumpingWithBlock = false, isOnLadders = false, lastClickInv = false,
useAntiNoFallSystem = false, canPingSpoof = false;
public boolean mustToBeSaved = false, wasFlying = false;
private boolean isOnGround = true, isBedrockPlayer = false;
public PacketType lastPacketType = null;
public FlyingReason flyingReason = FlyingReason.REGEN;
public Material eatMaterial = Material.AIR, lastClick = Material.AIR;
public Location lastSpiderLoc;
public InventoryMoveData inventoryMoveData = new InventoryMoveData();
public List<String> proof = new ArrayList<>();
public boolean isInFight = false;
public BukkitTask fightTask = null;
public String clientName;
public int ping = 0, protocolVersion = 0;
private Version playerVersion;
public SpigotNegativityPlayer(Player p) {
super(p.getUniqueId(), p.getName());
this.p = new WeakReference<>(p);
this.ping = Utils.getPing(p);
initMods(p);
this.clientName = "Not loaded";
isBedrockPlayer = FloodGateSupportManager.isBedrockPlayer(p.getUniqueId());
playerVersion = SpigotNegativity.viaVersionSupport ? ViaVersionSupport.getPlayerVersion(p)
: (SpigotNegativity.protocolSupportSupport ? ProtocolSupportSupport.getPlayerVersion(p) : Version.getVersion());
}
public SpigotNegativityPlayer(OfflinePlayer p) {
super(p.getUniqueId(), p.getName());
this.p = new WeakReference<>(null);
isBedrockPlayer = FloodGateSupportManager.isBedrockPlayer(p.getUniqueId());
playerVersion = Version.getVersion();
}
public void initMods(Player p) {
Plugin pl = SpigotNegativity.getInstance();
if (pl.isEnabled() && pl.getServer().getMessenger().isOutgoingChannelRegistered(pl, SpigotNegativity.CHANNEL_NAME_FML)) { // if
// not,
// we
// ignore
// it
p.sendPluginMessage(pl, SpigotNegativity.CHANNEL_NAME_FML, new byte[] { -2, 0 });
p.sendPluginMessage(pl, SpigotNegativity.CHANNEL_NAME_FML, new byte[] { 0, 2, 0, 0, 0, 0 });
p.sendPluginMessage(pl, SpigotNegativity.CHANNEL_NAME_FML, new byte[] { 2, 0, 0, 0, 0 });
} else
MODS.put("Not checked", "0.0");
}
@Override
public Player getPlayer() {
Player cached = p != null ? p.get() : null;
if (cached == null) {
cached = Bukkit.getPlayer(getUUID());
if (p != null)
p.clear();
p = new WeakReference<>(cached);
}
return cached;
}
public String getIP() {
return getPlayer().getAddress().getAddress().getHostAddress();
}
@Override
public Version getPlayerVersion() {
return playerVersion;
}
public int getProtocolVersion() {
return protocolVersion;
}
public void setProtocolVersion(int protocolVersion) {
this.protocolVersion = protocolVersion;
this.playerVersion = Version.getVersionByProtocolID(protocolVersion);
}
public boolean isBedrockPlayer() {
return isBedrockPlayer;
}
public boolean hasDetectionActive(Cheat c) {
if (!c.isActive() || UniversalUtils.TPS_DROP)
return false;
if (TIME_INVINCIBILITY > System.currentTimeMillis())
return false;
if (isInFight && c.isBlockedInFight())
return false;
if (SpigotNegativity.tps_alert_stop > Utils.getLastTPS()) // to make TPS go upper
return false;
Player p = getPlayer();
if (SpigotNegativity.gadgetMenuSupport && c.getCheatCategory().equals(CheatCategory.MOVEMENT) && GadgetMenuSupport.checkGadgetsMenuPreconditions(p))
return false;
if (c.getCheatCategory().equals(CheatCategory.MOVEMENT) && isUsingRiptide())
return false;
if (WorldRegionBypass.hasBypass(c, p.getLocation()))
return false;
if (SpigotNegativity.hasBypass && (Perm.hasPerm(this, "bypass." + c.getKey().toLowerCase(Locale.ROOT)) || Perm.hasPerm(this, "bypass.all")))
return false;
if (isBedrockPlayer && FloodGateSupportManager.disabledCheat.contains(c.getKey()))
return false;
return ping < c.getMaxAlertPing();
}
public String getWhyDetectionNotActive(Cheat c) {
if (!c.isActive())
return "Cheat disabled";
if (UniversalUtils.TPS_DROP)
return "TPS drop";
if (TIME_INVINCIBILITY > System.currentTimeMillis())
return "Player invincibility";
if (isInFight && c.isBlockedInFight())
return "In fight";
if (SpigotNegativity.tps_alert_stop > Utils.getLastTPS()) // to make TPS go upper
return "Low TPS";
Player p = getPlayer();
if (SpigotNegativity.gadgetMenuSupport && c.getCheatCategory().equals(CheatCategory.MOVEMENT) && GadgetMenuSupport.checkGadgetsMenuPreconditions(p))
return "GadgetMenu bypass";
if (c.getCheatCategory().equals(CheatCategory.MOVEMENT) && isUsingRiptide())
return "Riptide bypass";
if (WorldRegionBypass.hasBypass(c, p.getLocation()))
return "World bypass";
if (SpigotNegativity.hasBypass && (Perm.hasPerm(this, "bypass." + c.getKey().toLowerCase(Locale.ROOT)) || Perm.hasPerm(this, "bypass.all")))
return "Permission bypass";
if (ping > c.getMaxAlertPing())
return "Too high ping (" + ping + " > " + c.getMaxAlertPing() + ")";
if (isBedrockPlayer && FloodGateSupportManager.disabledCheat.contains(c.getKey()))
return "Bedrock player";
return "Unknown";
}
public void updateCheckMenu() {
for (Player p : Utils.getOnlinePlayers()) {
if (p.getOpenInventory() != null) {
Inventory topInv = p.getOpenInventory().getTopInventory();
if (topInv == null || !topInv.getType().equals(org.bukkit.event.inventory.InventoryType.CHEST)) {
continue;
}
InventoryHolder holder = topInv.getHolder();
if (holder instanceof CheckMenuHolder) {
AbstractInventory.getInventory(InventoryType.CHECK_MENU).ifPresent((inv) -> inv.actualizeInventory(p, ((CheckMenuHolder) holder).getCible()));
}
}
}
}
public void setBetterClick(int click) {
NegativityAccount account = getAccount();
account.setMostClicksPerSecond(click);
Adapter.getAdapter().getAccountManager().save(account.getPlayerId());
}
public void addWarn(Cheat c, int reliability) {
addWarn(c, reliability, 1);
}
public int addWarn(Cheat c, int reliability, int amount) {
if (System.currentTimeMillis() < TIME_INVINCIBILITY || c.getReliabilityAlert() > reliability)
return -1;
NegativityAccount account = getAccount();
int old = account.getWarn(c);
account.setWarnCount(c, old + amount);
mustToBeSaved = true;
return old;
}
public void setWarn(Cheat c, int cheats) {
NegativityAccount account = getAccount();
account.setWarnCount(c, cheats);
Adapter.getAdapter().getAccountManager().save(account.getPlayerId());
}
public void setLang(String newLang) {
NegativityAccount account = getAccount();
account.setLang(newLang);
NegativityAccountManager accountManager = Adapter.getAdapter().getAccountManager();
accountManager.save(account.getPlayerId());
if (accountManager instanceof SimpleAccountManager.Server) {
try {
((SimpleAccountManager.Server) accountManager).sendAccountToProxy(account);
} catch (IOException e) {
SpigotNegativity.getInstance().getLogger().log(Level.SEVERE, "Could not send account update to proxy", e);
}
}
}
public void clearPackets() {
PlayerPacketsClearEvent event = new PlayerPacketsClearEvent(getPlayer(), this);
SpigotNegativity.callSyncEvent(event);
int flying = PACKETS.getOrDefault(PacketType.Client.FLYING, 0);
if (flying > MAX_FLYING)
MAX_FLYING = flying;
ALL = 0;
PACKETS.clear();
}
public boolean getAllowFlight() {
return wasFlying || getPlayer().getAllowFlight();
}
@Override
public boolean isOp() {
return getPlayer().isOp();
}
@Override
public void startAnalyze(Cheat c) {
if (c.needPacket() && !INJECTED.contains(getPlayer().getUniqueId()))
INJECTED.add(getPlayer().getUniqueId());
}
@Override
public void startAllAnalyze() {
INJECTED.add(getPlayer().getUniqueId());
}
@Override
public void stopAnalyze(Cheat c) {
}
@Override
public String getReason(Cheat c) {
String n = "";
for (Cheat all : Cheat.values())
if (getAllWarn(all) > 5 && all.isActive())
n = n + (n.equals("") ? "" : ", ") + all.getName();
if (!n.contains(c.getName()))
n = n + (n.equals("") ? "" : ", ") + c.getName();
return n;
}
public List<PlayerCheatAlertEvent> getAlertForAllCheat() {
final List<PlayerCheatAlertEvent> list = new ArrayList<>();
ALERT_NOT_SHOWED.forEach((c, listAlerts) -> {
if (!listAlerts.isEmpty())
list.add(getAlertForCheat(c, listAlerts));
});
return list;
}
public PlayerCheatAlertEvent getAlertForCheat(Cheat c, List<PlayerCheatAlertEvent> list) {
int nb = 0, nbConsole = 0;
HashMap<Integer, Integer> relia = new HashMap<>();
HashMap<Integer, Integer> ping = new HashMap<>();
ReportType type = ReportType.NONE;
boolean hasRelia = false;
CheatHover hoverProof = null;
for (PlayerCheatAlertEvent e : list) {
nb += e.getNbAlert();
relia.put(e.getReliability(), relia.getOrDefault(e.getReliability(), 0) + 1);
ping.put(e.getPing(), ping.getOrDefault(e.getPing(), 0) + 1);
if (type == ReportType.NONE || (type == ReportType.WARNING && e.getReportType() == ReportType.VIOLATION))
type = e.getReportType();
hasRelia = e.hasManyReliability() ? true : hasRelia;
if (hoverProof == null)
hoverProof = e.getHover();
nbConsole += e.getNbAlertConsole();
e.clearNbAlertConsole();
}
// Don't to 100% each times that there is more than 2 alerts, we made a summary,
// and a the nb of alert to upgrade it
int newRelia = UniversalUtils.parseInPorcent(UniversalUtils.sum(relia) + nb);
int newPing = UniversalUtils.sum(ping);
// we can ignore "proof" and "stats_send" because they have been already saved
// and they are NOT showed to player
return new PlayerCheatAlertEvent(type, getPlayer(), c, newRelia, hasRelia, newPing, "", hoverProof, nb, nbConsole);
}
public void logProof(String msg) {
proof.add(msg);
}
public void saveProof() {
if (mustToBeSaved) {
mustToBeSaved = false;
Adapter.getAdapter().getAccountManager().save(getUUID());
}
if (proof.size() == 0)
return;
try {
File folder = new File(new File(SpigotNegativity.getInstance().getDataFolder(), "user"), "proof");
if (!folder.exists())
folder.mkdirs();
File temp = new File(folder, getUUID() + ".txt");
if (!temp.exists())
temp.createNewFile();
String msg = "";
for (String s : proof)
msg += s + "\n";
Files.write(temp.toPath(), msg.getBytes(), StandardOpenOption.APPEND);
proof.clear();
} catch (IOException e) {
e.printStackTrace();
}
}
private void destroy() {
saveProof();
UUID playerId = getUUID();
NegativityAccountManager accountManager = Adapter.getAdapter().getAccountManager();
accountManager.save(playerId);
accountManager.dispose(playerId);
}
@Override
public boolean hasDefaultPermission(String s) {
return getPlayer().hasPermission(s);
}
@Override
public double getLife() {
return ((Damageable) getPlayer()).getHealth();
}
@Override
public String getName() {
return getPlayer().getName();
}
@Override
public String getGameMode() {
return getPlayer().getGameMode().name();
}
@Override
public float getWalkSpeed() {
return getPlayer().getWalkSpeed();
}
@Override
public int getLevel() {
return getPlayer().getLevel();
}
@Override
public void kickPlayer(String reason, String time, String by, boolean def) {
getPlayer().kickPlayer(Messages.getMessage(getPlayer(), "ban.kick_" + (def ? "def" : "time"), "%reason%", reason, "%time%", String.valueOf(time), "%by%", by));
}
@SuppressWarnings("deprecation")
public boolean isOnGround() {
return isOnGround || getPlayer().isOnGround();
}
public void setOnGround(boolean b) {
this.isOnGround = b;
}
@Override
public void banEffect() {
int i = 2;
Location loc = getPlayer().getLocation();
World w = getPlayer().getWorld();
w.spawnEntity(loc, EntityType.FIREWORK);
w.spawnEntity(loc, EntityType.FIREWORK);
w.spawnEntity(loc, EntityType.FIREWORK);
w.spawnEntity(loc, EntityType.FIREWORK);
double baseY = loc.getY();
for (double y = baseY + 1.5; y > baseY; y = y - 0.05) {
for (int u = 0; u < 360; u += i) {
Location flameloc = loc.clone();
flameloc.setY(y);
flameloc.setZ(flameloc.getZ() + Math.cos(u) * i);
flameloc.setX(flameloc.getX() + Math.sin(u) * i);
if (Version.isNewerOrEquals(Version.getVersion(), Version.V1_13)) {
Particle.DustOptions dustOptions = new Particle.DustOptions(Color.ORANGE, 1);
w.spawnParticle(Particle.REDSTONE, flameloc, 1, 0, 0, 0, 0, dustOptions);
} else {
w.playEffect(flameloc.add(0, 1, 0), Utils.getEffect("COLOURED_DUST"), 1);
}
}
}
}
public void fight() {
isInFight = true;
if (fightTask != null)
fightTask.cancel();
fightTask = Bukkit.getScheduler().runTaskLater(SpigotNegativity.getInstance(), new Runnable() {
@Override
public void run() {
unfight();
}
}, 80);
}
public void unfight() {
isInFight = false;
if (fightTask != null)
fightTask.cancel();
fightTask = null;
}
public boolean hasElytra() {
return Version.getVersion().isNewerOrEquals(Version.V1_9) && getPlayer().isGliding();
}
public boolean isUsingTrident() {
return Version.getVersion().isNewerOrEquals(Version.V1_13) && (getPlayer().isRiptiding() || HandUtils.handUseItem(getPlayer(), "TRIDENT"));
}
public boolean isTargetByIronGolem() {
for (Entity et : getPlayer().getWorld().getEntities())
if (et instanceof IronGolem)
if (((IronGolem) et).getTarget() != null && ((IronGolem) et).getTarget().equals(getPlayer()))
return true;
return false;
}
public boolean hasPotionEffect(String effectName) {
try {
PotionEffectType potionEffect = PotionEffectType.getByName(effectName);
if (potionEffect != null) // If optionEffect is null, it doesn't exist in this version
return getPlayer().hasPotionEffect(potionEffect);
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
public boolean isUsingRiptide() {
return Version.getVersion().isNewerOrEquals(Version.V1_13) && getPlayer().isRiptiding();
}
public PotionEffect getPotionEffect(PotionEffectType type) {
return getPlayer().getActivePotionEffects().stream().filter((pe) -> pe.getType().equals(type)).findAny().orElse(null);
}
public static SpigotNegativityPlayer getNegativityPlayer(Player p) {
synchronized (players) {
return players.computeIfAbsent(p.getUniqueId(), id -> new SpigotNegativityPlayer(p));
}
}
public static SpigotNegativityPlayer getNegativityPlayer(OfflinePlayer p) {
synchronized (players) {
return players.computeIfAbsent(p.getUniqueId(), id -> new SpigotNegativityPlayer(p));
}
}
public static Map<UUID, SpigotNegativityPlayer> getAllPlayers() {
return players;
}
public static void removeFromCache(UUID playerId) {
SpigotNegativityPlayer cached = players.remove(playerId);
if (cached != null) {
cached.destroy();
}
}
}
// NOTE (AI): The probe is the outbound S3F side (lines 122-134). SpigotNegativity registers the FML and brand channels (SpigotNegativity.java lines 164-171), and ChannelEvents.java is the C17 reply reader.Related Packets
Wiki Cross-Reference
Channel string capped at 20 chars plus raw payload capped at 1048576 bytes (1MB); larger payloads throw IOException.
Vanilla channels: MC|Brand sent once at join, MC|TrList villager trades, MC|BOpen written book. Unknown channels are ignored.
MCP 1.8.9 S3FPacketCustomPayload implements Packet
1.8.9 callers: EntityPlayerMP.displayVillagerTradeGui sends new S3FPacketCustomPayload (line 819) +1 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.