private PacketContainer newObjectivePacket(UpdateType mode) {
        // http://wiki.vg/Protocol#Scoreboard_Objective
        PacketContainer packet = new PacketContainer(PacketType.Play.Server.SCOREBOARD_OBJECTIVE);

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

        // set mode - 0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.
        packet.getIntegers().write(0, mode.getCode());

        if (USING_CHAT_COMPONENTS) {
            // set display name - Component
            packet.getChatComponents().write(0, PacketScoreboard.toComponent(getDisplayName()));
        } else {
            // set display name - limited to String(16) - Only if mode is 0 or 2. The text to be displayed for the score
            packet.getStrings().write(1, getDisplayName());
        }

        // set type - either "integer" or "hearts"
        packet.getEnumModifier(HealthDisplay.class, 2).write(0, HealthDisplay.INTEGER);

        return packet;
    }
Creates a new scoreboard objective

@param id the id of this objective
@param displayName the initial display name
@param displaySlot the initial display slot
helper/src/main/java/me/lucko/helper/scoreboard/PacketScoreboardObjective.java