//  [java]
    public void translate(GeyserSession session, ServerTeamPacket packet) {
        if (LOGGER.isDebug()) {
            LOGGER.debug("Team packet " + packet.getTeamName() + " " + packet.getAction() + " " + Arrays.toString(packet.getPlayers()));
        }

        int pps = session.getWorldCache().increaseAndGetScoreboardPacketsPerSecond();

        Scoreboard scoreboard = session.getWorldCache().getScoreboard();
        Team team = scoreboard.getTeam(packet.getTeamName());
        switch (packet.getAction()) {
            case CREATE:
                scoreboard.registerNewTeam(packet.getTeamName(), toPlayerSet(packet.getPlayers()))
                        .setName(MessageTranslator.convertMessage(packet.getDisplayName()))
                        .setColor(packet.getColor())
                        .setNameTagVisibility(packet.getNameTagVisibility())
                        .setPrefix(MessageTranslator.convertMessage(packet.getPrefix(), session.getLocale()))
                        .setSuffix(MessageTranslator.convertMessage(packet.getSuffix(), session.getLocale()));
                break;
            case UPDATE:
                if (team == null) {
                    LOGGER.debug(LanguageUtils.getLocaleStringLog(
                            "geyser.network.translator.team.failed_not_registered",
                            packet.getAction(), packet.getTeamName()
                    ));
                    return;
                }

                team.setName(MessageTranslator.convertMessage(packet.getDisplayName()))
                        .setColor(packet.getColor())
                        .setNameTagVisibility(packet.getNameTagVisibility())
                        .setPrefix(MessageTranslator.convertMessage(packet.getPrefix(), session.getLocale()))
                        .setSuffix(MessageTranslator.convertMessage(packet.getSuffix(), session.getLocale()))
                        .setUpdateType(UpdateType.UPDATE);
                break;
            case ADD_PLAYER:
                if (team == null) {
                    LOGGER.debug(LanguageUtils.getLocaleStringLog(
                            "geyser.network.translator.team.failed_not_registered",
                            packet.getAction(), packet.getTeamName()
                    ));
                    return;
                }
                team.addEntities(packet.getPlayers());
                break;
            case REMOVE_PLAYER:
                if (team == null) {
                    LOGGER.debug(LanguageUtils.getLocaleStringLog(
                            "geyser.network.translator.team.failed_not_registered",
                            packet.getAction(), packet.getTeamName()
                    ));
                    return;
                }
                team.removeEntities(packet.getPlayers());
                break;
            case REMOVE:
                scoreboard.removeTeam(packet.getTeamName());
                break;
        }

        // ScoreboardUpdater will handle it for us if the packets per second
        // (for score and team packets) is higher then the first threshold
        if (pps < ScoreboardUpdater.FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD) {
            scoreboard.onUpdate();
        }
    }