private PacketContainer newUpdatePacket() {
        // http://wiki.vg/Protocol#Teams
        PacketContainer packet = new PacketContainer(PacketType.Play.Server.SCOREBOARD_TEAM);

        // set team name - 	String (16)
        packet.getStrings().write(0, getId());

        // set mode - byte
        packet.getIntegers().write(GTEQ_1_13 ? 0 : 1, UpdateType.UPDATE.getCode());

        AbstractStructure struct;
        if (GTEQ_1_17) {
            struct = packet.getOptionalStructures().readSafely(0).get();
        } else {
            struct = packet;
        }

        if (GTEQ_1_13) {
            // set display name - Component
            struct.getChatComponents().write(0, PacketScoreboard.toComponent(getDisplayName()));

            // set prefix - Component
            struct.getChatComponents().write(1, PacketScoreboard.toComponent(getPrefix()));

            // set suffix - Component
            struct.getChatComponents().write(2, PacketScoreboard.toComponent(getSuffix()));
        } else {
            // set display name - String(32)
            struct.getStrings().write(1, getDisplayName());

            // set prefix - String(16)
            struct.getStrings().write(2, getPrefix());

            // set suffix - String(16)
            struct.getStrings().write(3, getSuffix());
        }

        // friendly flags - byte - Bit mask. 0x01: Allow friendly fire, 0x02: can see invisible entities on same team
        int flags = 0;
        if (isAllowFriendlyFire()) {
            flags |= 1;
        }
        if (isCanSeeFriendlyInvisibles()) {
            flags |= 2;
        }

        // set flags
        struct.getIntegers().write(GTEQ_1_17 ? 0 : GTEQ_1_13 ? 1 : 2, flags);

        // set nametag visibility - String Enum (32)
        struct.getStrings().write(GTEQ_1_17 ? 0 : GTEQ_1_13 ? 1 : 4, getNameTagVisibility().getProtocolName());

        if (SUPPORTS_COLLISION_RULE) {
            // set collision rule - String Enum (32)
            struct.getStrings().write(GTEQ_1_17 ? 1 : GTEQ_1_13 ? 2 : 5, getCollisionRule().getProtocolName());
        }

        // set color - byte - For colors, the same Chat colors (0-15). -1 indicates RESET/no color.
        if (GTEQ_1_13) {
            struct.getEnumModifier(ChatColor.class, MinecraftReflection.getMinecraftClass("EnumChatFormat")).write(0, getColor());
        } else {
            struct.getIntegers().write(0, COLOR_CODES.getOrDefault(getColor(), -1));
        }

        if (GTEQ_1_17) {
            packet.getOptionalStructures().write(0, Optional.of((InternalStructure) struct));
        }

        return packet;
    }
Creates a new scoreboard team

@param id the id of this team
@param displayName the initial display name
helper/src/main/java/me/lucko/helper/scoreboard/PacketScoreboardTeam.java