0x3E S3EPacketTeams
Create/update/remove a scoreboard team. Manages team name, prefix/suffix, players, friendly fire, and nametag visibility.
Published 2026-06-18 · Updated 2026-10-14
Fields
| Field | Type | Description |
|---|---|---|
| name | String | Team name |
| displayName | String | Team display name |
| prefix/suffix | String | Name prefix/suffix |
| friendlyFire | byte | 0=off, 1=on, 3=seeFriendlyInvisibles |
| nametagVisibility | String | always, hideForOtherTeams, hideForOwnTeam, never |
| color | byte | Team color for player list |
| players | String[] | Team members |
| action | byte | 0=create, 1=remove, 2=infoUpdate, 3=addPlayers, 4=removePlayers |
Wire Encoding
| Field | Type | Notes |
|---|---|---|
| Name | String | |
| Action | byte | 0=create, 1=remove, 2=update, 3=add, 4=remove |
| Per-Action Fields | varies | Depends on action |
MCP References
NetHandlerPlayClient.handleTeams()Handler Interface
INetHandlerPlayClientVanilla 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 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
Deobfuscated MCP 1.8.9 source of S3EPacketTeams, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/server/S3EPacketTeams.java) at build time and verified present.
Deep Dive
Role in the protocol
Scoreboard team management. The action byte drives five modes: 0 create, 1 remove, 2 update info, 3 add players, 4 remove players. Info fields for actions 0 and 2 are display name (32-char cap), prefix (16), suffix (16), a friendly-fire byte, the nametag visibility string (32), and a color byte indexing EnumChatFormatting. Player lists follow for actions 0, 3, and 4 as a VarInt count of 40-char names. Team color drives the nametag color in the client renderer, which makes this packet the surface for team-colored nametag features.
Vanilla handling
handleTeams creates or fetches the team by registered name, applies the info fields for actions 0 and 2, then adds or removes memberships for actions 3 and 4. The client stores teams in its scoreboard; the nametag renderer reads team color and visibility per player each frame. ServerConfigurationManager replays existing teams to a joining player with action 0.
Why clients touch it
Only Rise 6.x. StaffDetector carries a fully commented-out S3EPacketTeams branch that would scan team members for staff names and trigger an auto-leave (/hub) after six hits; the live module relies on the S38 player-list scan instead. The commented block proves the teams surface was tried and abandoned in favor of S38. Rise also registers the class in the script API. No client colors ESP by team here: nametag coloring is left to vanilla rendering.
Exploit surface
The color byte is server-controlled; a client cannot push team colors back because S3E is clientbound. Nametag-visibility abuse (hiding tags via team properties) is a server-side decision. The interesting angle is staff detection: team rosters leak staff membership on servers that place staff in teams, and the Rise staff list plus a six-hit counter is the pattern. It is entirely client-side reading and undetectable.
Server-Side Handling
ServerScoreboard broadcasts S3E on team create (0), remove (1), info update (2), player add (3), and player remove (4). ServerConfigurationManager sends a create replay to each joining player so the client knows existing teams and their colors before the world settles. All sends go through sendPacketToAllPlayers or the per-player handler.
Protocol Analysis
Wire order: team name (16-char cap), action byte, then for actions 0 and 2 the info block, then for actions 0, 3, and 4 a VarInt count of 40-char member names. The packet constructors throw IllegalArgumentException for player actions with empty member lists, and the read path trusts the action byte to choose which trailing fields exist.
Anti-Cheat Landscape
Not monitored. The team color byte feeds EnumChatFormatting.func_175744_a, so a malformed color renders garbage but cannot crash. StaffDetector's commented branch is the only staff-detection use of teams in the corpus, and it never runs.
implementation Implementation Cases
Team management and nametag color. Rise 6.x StaffDetector contains the only module reference, and it is commented out: the teams scan was replaced by the S38 player-list scan. Everything else is vanilla plus the script API table.
Detect staff by name and auto-leave. The S3EPacketTeams branch is disabled in the shipped source; the module's active path scans S38PacketPlayerListItem instead.
onPacketReceive contains a commented block that iterates teams.func_149310_g(), checks member names against a hardcoded staff array, increments a counter per hit, and sends /hub via C01PacketChatMessage after six hits. The counter decays each PreMotion tick. The block is dead code in both 6.1.30 and 6.2.4.
// ===== FILE: Rise 6.1.30, com/alan/clients/module/impl/exploit/StaffDetector.java =====
package com.alan.clients.module.impl.exploit;
import com.alan.clients.event.Listener;
import com.alan.clients.event.annotations.EventLink;
import com.alan.clients.event.impl.motion.PreMotionEvent;
import com.alan.clients.event.impl.packet.PacketReceiveEvent;
import com.alan.clients.module.Module;
import com.alan.clients.module.api.Category;
import com.alan.clients.module.api.ModuleInfo;
import com.alan.clients.value.impl.BooleanValue;
import net.minecraft.network.Packet;
@ModuleInfo(aliases = {"module.combat.staffdetector.name"}, description = "module.exploit.staffdetector.description", category = Category.EXPLOIT)
public class StaffDetector extends Module {
BooleanValue autoLeave = new BooleanValue("Auto Leave", this, true);
private String[] staff;
private int count;
public StaffDetector() {
String input = "idhoom,7so,1sweet,jinaaan,ev2n,eissaa,mohmad_q8,1daykel,ximtaig_,nshme,comsterr,e9_,1meko,1lab,mk_f16,loovq,_sadeq,nv0ola,1f5amh___3oo,frecss217,xmz7,a2bod,eyeso_diamond,bunkrat,1rana,1ahmd,1heyimhasson_,casteret,1elyy,1zeyad,lt1x,firas,postme,3mmr,xl2d,yzed,y2men,iv2a,_nonameishere_,0hfault,deficency,anauri,xluffy1,kinderbueno__,_revoox_,xidayzer,i7ilin,1adam__,27bk,ventz_,awfultimes,ahm2d,gsomar,mvp11,xxkhaledxxcraft,aymann_,1iraqi,rambokinq,undertest,zswift,strongest0ne,neverletyouknow,zixgamer,sanfoor_j,ixghoul_,imbexsl_,glowdown_,hunter47,fexoranep,1reyleigh,420waffle,ywgiz,sweetyalice,xfahadq,mr3nb_,akash1004,zaytonaaa,rma7o,mr_1990,iali_305,wacros,lwwh,pynifical,rivsci,itsjuan_,meedo_qb,_r3,1speedo_,_justidk,505t,xzvv,mauveracer,_1hypersx_,rayqquaza,swivee,absqtulate,opgaming2009,vhagardracarys,luffy404,faisaal420,hdzt,sunsnipebeastwtf,_odex,1ashu,n13m_,callinu,sh59,drnyx,iisrab5bgii,haoeris,lxrayanxl,toxiclayer,greatm7md,brksfrb2,madix707,hnxrr,1sweetty,ohhhhqls,solidfying,_i_b,escoco,dreadpirater0b,aboshxm,0ryze,spuvr,va_1,kingpvp90,rieus,prebowed,mitsichu,gogglas,battlebay,32lbo,7far_8bor,evenfai,hlazny,valrm";
staff = input.split(",");
}
@EventLink
public final Listener<PreMotionEvent> onPreMotion = event -> {
count = Math.max(0, count - 1);
};
@EventLink
public final Listener<PacketReceiveEvent> onPacketReceive = event -> {
Packet<?> packet = event.getPacket();
// if (packet instanceof S3EPacketTeams) {
// final S3EPacketTeams teams = (S3EPacketTeams) packet;
//
// for (final String name : teams.func_149310_g()) {
// if (Arrays.asList(staff).contains(name.toLowerCase())) {
// count++;
//
// if (count == 6) {
// ChatUtil.display("Staff Detected " + name);
//
// if (autoLeave.getValue()) PacketUtil.send(new C01PacketChatMessage("/hub"));
// }
// }
// }
// }
// if (packet instanceof S38PacketPlayerListItem) {
// S38PacketPlayerListItem item = ((S38PacketPlayerListItem) packet);
//
// for (S38PacketPlayerListItem.AddPlayerData player : item.func_179767_a()) {
// if (player == null || player.getProfile() == null || player.getProfile().getName() == null) {
// continue;
// } else if (!player.getProfile().getName().equals("SHOP") && !player.getProfile().getName().equals("UPGRADES")) {
// ChatUtil.display("Username: " + player.getProfile().getName());
// }
//
// if (Arrays.asList(staff).contains(player.getProfile().getName().toLowerCase())) {
// ChatUtil.display("Staff Detected " + player.getProfile().getName());
//
// if (autoLeave.getValue()) PacketUtil.send(new C01PacketChatMessage("/hub"));
// }
// }
// }
// if (packet instanceof S) {
// S06PacketUpdateHealth health = ((S06PacketUpdateHealth) packet);
//
// }
};
}
// NOTE (AI): The S3EPacketTeams branch on lines 37-51 is commented out in the shipped source. It would have counted team-member hits against the staff list and fired an auto-leave at six hits. The active S38PacketPlayerListItem scan is also commented out, leaving the module a staff-name list and a decaying counter.Expose the packet class to Rise's JavaScript scripting API.
S3EPacketTeams is listed in the clientbound Class array of NetworkAPI.java (line 105).
// ===== 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 S3EPacketTeams at line 105. Identical file ships in Rise 6.2.4 under Client-release2/Client/src/main/java.anticheat Anti-Cheat Checks
S3E is the one scoreboard packet anticheats actually consume and produce. Grim reads the outbound team stream into per-entity team state that its collision predicates use; intave rewrites the collision rule on outbound team packets and emits team packets to hide fake-player nametags; Shard's monitor emits team packets to render the target name tag and watches for conflicting team traffic. Photon's Teaming is the only flagging check in the domain and it is driven by Bukkit events, not the packet. The rest of the corpus is noise: Rammelkast and AntiCheatPlus match the 'AntiCheat Team' license header on every file, NCP's CollisionUtil reads the Bukkit scoreboard API, and Negativity plus Artemis only register the packet class.
Keep a transaction-ordered mirror of the client's team state so entity checks know the collision and push rules between players and entities.
TeamHandler is a PacketSendListener on PacketType.Play.Server.TEAMS. On each S3E it wraps the packet, reads the team name, and schedules a real-time task at the last transaction id so the update applies at the same tick the client processes it. CREATE builds a new EntityTeam, REMOVE drops it, and the other modes update the stored team with the collision rule from the packet. EntityTeam maps members to the team by UUID, and MovementTicker plus EntityPredicates consult it to decide whether an entity can push the player.
// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/team/TeamHandler.java =====
package ac.grim.grimac.utils.team;
import ac.grim.grimac.checks.Check;
import ac.grim.grimac.checks.type.PacketSendListener;
import ac.grim.grimac.player.GrimPlayer;
import ac.grim.grimac.utils.data.packetentity.PacketEntity;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerTeams;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import lombok.Getter;
import lombok.Setter;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
import java.util.UUID;
// Reminder: Entities use UUIDs, players use name, for setting teams.
public class TeamHandler extends Check implements PacketSendListener {
private final Map<String, EntityTeam> entityTeams = new Object2ObjectOpenHashMap<>();
private final Map<String, EntityTeam> entityToTeam = new Object2ObjectOpenHashMap<>();
private @Getter @Setter @Nullable EntityTeam playerTeam = null;
public TeamHandler(GrimPlayer player) {
super(player);
}
public void addEntityToTeam(String entityTeamRepresentation, EntityTeam team) {
entityToTeam.put(entityTeamRepresentation, team);
}
public void removeEntityFromTeam(String entityTeamRepresentation) {
entityToTeam.remove(entityTeamRepresentation);
}
public EntityTeam getEntityTeam(PacketEntity entity) {
// TODO in what cases is UUID null in 1.9+?
final UUID uuid = entity.getUuid();
return uuid == null ? null : entityToTeam.get(uuid.toString());
}
@Override
public void onPacketSend(PacketSendEvent event) {
if (event.getPacketType() == PacketType.Play.Server.TEAMS) {
WrapperPlayServerTeams teams = new WrapperPlayServerTeams(event);
final String teamName = teams.getTeamName();
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {
EntityTeam entityTeam = switch (teams.getTeamMode()) {
case CREATE -> {
var newTeam = new EntityTeam(player, teamName);
entityTeams.put(teamName, newTeam);
yield newTeam;
}
case REMOVE -> entityTeams.remove(teamName);
default -> entityTeams.get(teamName);
};
if (entityTeam != null) {
entityTeam.update(teams);
}
});
}
}
}
// NOTE (AI): The S3E branch is lines 44-65. EntityTeam.update (EntityTeam.java lines 25-45) stores the collision rule and routes ADD_ENTITIES and REMOVE_ENTITIES into the player-team and entity maps; EntityPredicates.canBePushedBy evaluates the CollisionRule values.Flag UHC players who cooperate by clustering, the teaming cheat domain that S3E team membership normally exposes.
Every 5 seconds the check builds a 3D RTree of eligible players (adventure or survival mode, out of combat, outside configured safe zones and WorldGuard no-PVP regions), then clusters players within a configurable proximity range who can see each other. Any cluster larger than the allowed size flags every member with a violation level equal to the surplus. The corpus hit is the team domain: the check never parses S3E and never reads Bukkit team state.
// ===== FILE: Photon-GitHub-AntiCheatAddition, src/main/java/de/photon/anticheataddition/modules/checks/teaming/Teaming.java =====
package de.photon.anticheataddition.modules.checks.teaming;
import com.github.davidmoten.rtreemulti.Entry;
import com.github.davidmoten.rtreemulti.RTree;
import com.github.davidmoten.rtreemulti.geometry.Point;
import com.google.common.base.Preconditions;
import de.photon.anticheataddition.AntiCheatAddition;
import de.photon.anticheataddition.modules.ViolationModule;
import de.photon.anticheataddition.user.User;
import de.photon.anticheataddition.user.data.TimeKey;
import de.photon.anticheataddition.util.log.Log;
import de.photon.anticheataddition.util.mathematics.TimeUtil;
import de.photon.anticheataddition.util.minecraft.world.region.Region;
import de.photon.anticheataddition.util.minecraft.world.region.WorldGuardRegionUtil;
import de.photon.anticheataddition.util.violationlevels.Flag;
import de.photon.anticheataddition.util.violationlevels.ViolationLevelManagement;
import de.photon.anticheataddition.util.violationlevels.ViolationManagement;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
public final class Teaming extends ViolationModule implements Listener
{
public static final Teaming INSTANCE = new Teaming();
private static final long CHECK_INTERVAL = TimeUtil.toTicks(5000);
private Teaming()
{
super("Teaming");
}
private Set<World> loadEnabledWorlds()
{
final Set<World> worlds = new HashSet<>();
for (final String key : loadStringList(".enabled_worlds")) {
final var world = Bukkit.getWorld(key);
if (world == null) {
Log.fine(() -> "Unable to load world \"" + key + "\" in teaming check.");
continue;
}
worlds.add(world);
}
return Set.copyOf(worlds);
}
private Set<Region> loadSafeZones(Set<World> enabledWorlds)
{
final Set<Region> safeZones = new HashSet<>();
for (final String s : loadStringList(".safe_zones")) {
try {
final var region = Region.parseRegion(s);
if (enabledWorlds.contains(region.world())) safeZones.add(region);
} catch (NullPointerException e) {
Log.severe(() -> "Unable to load safe zone \"" + s + "\" in teaming check, is the world correct?");
} catch (ArrayIndexOutOfBoundsException e) {
Log.severe(() -> "Unable to load safe zone \"" + s + "\" in teaming check, are all coordinates present?");
}
}
return Set.copyOf(safeZones);
}
@Override
public void enable()
{
final var enabledWorlds = loadEnabledWorlds();
final var safeZonesLoading = new HashSet<>(loadSafeZones(enabledWorlds));
if (loadBoolean(".worldguard", false)) safeZonesLoading.addAll(WorldGuardRegionUtil.loadNoPVPRegions(enabledWorlds));
final var safeZones = Set.copyOf(safeZonesLoading);
final double proximityRange = loadDouble(".proximity_range", 4.5);
final int noPvpTime = loadInt(".no_pvp_time", 6000);
final int allowedSize = loadInt(".allowed_size", 1);
Preconditions.checkArgument(allowedSize > 0, "The Teaming allowed_size must be greater than 0.");
Bukkit.getScheduler().runTaskTimer(AntiCheatAddition.getInstance(), () -> {
for (World world : enabledWorlds) {
// Pre-calculate the entries for the RTree for faster initialization.
final List<Entry<Player, Point>> entries = new ArrayList<>();
for (Player player : world.getPlayers()) {
final User user = User.getUser(player);
if (!User.isUserInvalid(user, Teaming.INSTANCE)
// Correct game modes.
&& user.inAdventureOrSurvivalMode()
// Not engaged in pvp.
&& user.getTimeMap().at(TimeKey.COMBAT).notRecentlyUpdated(noPvpTime)) {
final var loc = player.getLocation();
// Not in a bypassed region.
if (safeZones.stream().noneMatch(safeZone -> safeZone.isInsideRegion(loc))) {
entries.add(User.rTreeEntryFromPlayer(player));
}
}
}
// Create an RTree for the players in the world.
RTree<Player, Point> rTree = RTree.dimensions(3).create(entries);
final var origin = Point.create(0, 0, 0);
while (!rTree.isEmpty()) {
final var firstNode = rTree.nearest(origin, Double.POSITIVE_INFINITY, 1).iterator().next();
final var teamNodes = rTree.nearest(firstNode.geometry(), proximityRange, 1000);
// Get the players.
final List<Player> team = new ArrayList<>();
for (Entry<Player, Point> node : teamNodes) {
// Players need to see each other to be considered to be in a team.
if (firstNode.value().canSee(node.value()) && node.value().canSee(firstNode.value())) team.add(node.value());
}
Log.finer(() -> "Teaming | Team: " + team.stream().map(Player::getName).collect(Collectors.joining(", ")));
rTree = rTree.delete(teamNodes);
// Team is too big
final int vl = team.size() - allowedSize;
if (vl <= 0) continue;
for (final var player : team) this.getManagement().flag(Flag.of(player).setAddedVl(vl));
}
}
}, 1L, CHECK_INTERVAL);
}
@Override
protected ViolationManagement createViolationManagement()
{
return ViolationLevelManagement.builder(this)
.loadThresholdsToManagement()
.withDecay(300, 1)
.build();
}
}
// NOTE (AI): No scoreboard or packet API is used anywhere in this file; the check is matched to the team domain by name only. The clustering runs on a Bukkit scheduler, never on S3E.Patch outbound team packets so the monitored player stops colliding with entities, a server-side no-collision service.
A HIGHEST-priority ProtocolLib subscription on the outbound SCOREBOARD_TEAM packet rewrites the collision-rule string field to 'never' before the packet reaches the client. Version-dependent field indexes handle the 1.13 and 1.17 wire changes, and on 1.17+ the rule is read from the optional internal structure instead of the top-level string list. Active only on 1.9+ servers where the team packet carries a collision rule.
// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/tracker/entity/EntityCollisionDisabler.java =====
package de.jpx3.intave.module.tracker.entity;
import com.comphenix.protocol.events.InternalStructure;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.reflect.StructureModifier;
import de.jpx3.intave.adapter.MinecraftVersions;
import de.jpx3.intave.module.Module;
import de.jpx3.intave.module.linker.packet.ListenerPriority;
import de.jpx3.intave.module.linker.packet.PacketSubscription;
import java.util.Optional;
import static de.jpx3.intave.module.linker.packet.PacketId.Server.SCOREBOARD_TEAM;
public final class EntityCollisionDisabler extends Module {
private static final boolean DISABLE_ENTITY_COLLISIONS = MinecraftVersions.VER1_9_0.atOrAbove();
private static final int COLLISION_RULE_FIELD = (MinecraftVersions.VER1_13_0.atOrAbove() ? (MinecraftVersions.VER1_17_0.atOrAbove() ? 1 : 2) : 5);
private static final boolean INDIRECT_SCOREBOARD_ACCESS = MinecraftVersions.VER1_17_0.atOrAbove();
@PacketSubscription(
priority = ListenerPriority.HIGHEST,
packetsOut = {
SCOREBOARD_TEAM
}
)
public void receiveScoreboardUpdate(PacketEvent event) {
if (!DISABLE_ENTITY_COLLISIONS) {
return;
}
PacketContainer packet = event.getPacket();
if (INDIRECT_SCOREBOARD_ACCESS) {
//noinspection OptionalAssignedToNull
if (packet.getSpecificModifier(Optional.class).read(0) != null) {
Optional<InternalStructure> optionalStructure = packet.getOptionalStructures().read(0);
if (optionalStructure.isPresent()) {
InternalStructure structure = optionalStructure.get();
StructureModifier<String> strings = structure.getStrings();
applyNoCollisionRule(strings);
}
}
} else {
applyNoCollisionRule(packet.getStrings());
}
}
private void applyNoCollisionRule(StructureModifier<String> strings) {
strings.write(COLLISION_RULE_FIELD, "never");
}
}
// NOTE (AI): A genuine S3E (PacketPlayOutScoreboardTeam) consumer; it appears in the S3C corpus only because the Scoreboard keyword matched the method name receiveScoreboardUpdate.Hide the nametag of intave's fake-player bait entities so ESP and nametag features cannot distinguish them from real players.
sendScoreboard builds a PacketPlayOutScoreboardTeam with action 3 (ADD_PLAYERS) that places the fake player profile in a dedicated team, then, when hiding is requested, sends a second team packet with action 2 (UPDATE) that sets nameTagVisibility to NEVER. FakePlayerBody invokes it at spawn (FakePlayerBody.java line 318).
// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/player/fake/ScoreboardAccessor.java =====
package de.jpx3.intave.player.fake;
import com.comphenix.protocol.wrappers.WrappedGameProfile;
import com.google.common.collect.ImmutableList;
import de.jpx3.intave.klass.rewrite.PatchyAutoTranslation;
import net.minecraft.server.v1_8_R3.*;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
@PatchyAutoTranslation
public final class ScoreboardAccessor {
@PatchyAutoTranslation
public static void sendScoreboard(
Player player,
String teamName,
WrappedGameProfile fakePlayerProfile,
boolean hideNameTag
) {
PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
ImmutableList<String> teamList = ImmutableList.of(fakePlayerProfile.getName());
ScoreboardTeam scoreboardTeam = new ScoreboardTeam(new Scoreboard(), teamName);
PacketPlayOutScoreboardTeam packet = new PacketPlayOutScoreboardTeam(scoreboardTeam, teamList, 3);
connection.sendPacket(packet);
if (hideNameTag) {
scoreboardTeam.setNameTagVisibility(ScoreboardTeamBase.EnumNameTagVisibility.NEVER);
connection.sendPacket(new PacketPlayOutScoreboardTeam(scoreboardTeam, 2));
}
}
}
// NOTE (AI): Emits the 1.8 S3E ADD_PLAYERS (action 3) and UPDATE (action 2) modes; the constructor is version-locked through @PatchyAutoTranslation.Render the monitored target's name tag by emitting its own S3E team packets, and keep that rendering valid against other plugins' team traffic.
ViewTeamPacketBridge builds WrapperPlayServerTeams packets (CREATE, UPDATE, ADD_ENTITIES and REMOVE) whose prefix and suffix carry the rendered tag, with the collision rule and nametag visibility forced to ALWAYS so the monitor's tag never interferes with physics. Its companion ViewTeamConflictObserver listens for outbound S3E at MONITOR priority and, when the session renders above the name, marks the target's tag for rebind whenever another plugin creates a team or adds the target to one.
// ===== FILE: KaelusAI-Shard, src/main/kotlin/ac/shard/monitor/view/ViewTeamPacketBridge.kt =====
/*
* This file is part of Shard - https://github.com/KaelusAI/Shard
* Copyright (C) 2026 KaelusAI
*
* Shard is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Shard is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ac.shard.monitor.view
import ac.shard.monitor.core.ComponentCache
import com.github.retrooper.packetevents.PacketEvents
import com.github.retrooper.packetevents.wrapper.PacketWrapper
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerTeams
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.format.NamedTextColor
import org.bukkit.entity.Player
internal class ViewTeamPacketBridge(private val componentCache: ComponentCache) {
fun createTeam(viewer: Player, teamName: String, playerName: String, rendered: RenderedTag) {
val wrapper =
WrapperPlayServerTeams(
teamName,
WrapperPlayServerTeams.TeamMode.CREATE,
createTeamInfo(rendered),
listOf(playerName),
)
sendPacket(viewer, wrapper)
}
fun updateTeam(viewer: Player, teamName: String, rendered: RenderedTag) {
val wrapper =
WrapperPlayServerTeams(
teamName,
WrapperPlayServerTeams.TeamMode.UPDATE,
createTeamInfo(rendered),
emptyList(),
)
sendPacket(viewer, wrapper)
}
fun rebindEntity(viewer: Player, teamName: String, playerName: String) {
val wrapper =
WrapperPlayServerTeams(
teamName,
WrapperPlayServerTeams.TeamMode.ADD_ENTITIES,
null as WrapperPlayServerTeams.ScoreBoardTeamInfo?,
listOf(playerName),
)
sendPacket(viewer, wrapper)
}
fun removeTeam(viewer: Player, teamName: String) {
val wrapper =
WrapperPlayServerTeams(
teamName,
WrapperPlayServerTeams.TeamMode.REMOVE,
null as WrapperPlayServerTeams.ScoreBoardTeamInfo?,
emptyList<String>(),
)
sendPacket(viewer, wrapper)
}
private fun createTeamInfo(rendered: RenderedTag): WrapperPlayServerTeams.ScoreBoardTeamInfo {
return WrapperPlayServerTeams.ScoreBoardTeamInfo(
Component.empty(),
componentCache.component(rendered.prefix),
componentCache.component(rendered.suffix),
WrapperPlayServerTeams.NameTagVisibility.ALWAYS,
WrapperPlayServerTeams.CollisionRule.ALWAYS,
NamedTextColor.WHITE,
WrapperPlayServerTeams.OptionData.NONE,
)
}
private fun sendPacket(viewer: Player, packet: PacketWrapper<*>) {
PacketEvents.getAPI().playerManager.sendPacket(viewer, packet)
}
}
// NOTE (AI): Emit side only in this file (CREATE, UPDATE, ADD_ENTITIES and REMOVE at lines 29-71). The consume side is ViewTeamConflictObserver.kt, which reads WrapperPlayServerTeams on PacketSendEvent and schedules rebinds for the monitored target.Related Packets
Wiki Cross-Reference
The team color byte maps onto formatting codes: 0-15 are the chat colors and 16-21 are obfuscation, bold, strikethrough, underline, italic, and reset.
The friendly-fire field is a bitmask (0x01 allow friendly fire, 0x02 see same-team invisible players), so value 3 means both behaviors are on.
MCP 1.8.9 S3EPacketTeams implements Packet
1.8.9 callers: ServerScoreboard.addPlayerToTeam sends new S3EPacketTeams (line 96) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/scoreboard/ServerScoreboard.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.