var commanderMenu = new ChatMenu("Commander Menu");

        foreach (var commanderFunction in _commanderFunctions)
        {
            commanderMenu.AddMenuOption(commanderFunction.Name, ((controller, option) =>
            {
                if (!commanderFunction.PlayersChoice)
                {
                    commanderFunction.OnSelect(player);
                    return;
                }

                var inmatesMenu = new ChatMenu("Select a player");
                var inmates = Utilities.GetPlayers().Where(player => commanderFunction.PlayerChoiceExpression(player));


                foreach (var inmate in inmates)
                {
                    inmatesMenu.AddMenuOption(inmate.PlayerName,
                        ((playerController, menuOption) => commanderFunction.OnSelect(player, inmate)));
                }

                MenuManager.OpenChatMenu(player, inmatesMenu);
            }));
        }

        MenuManager.OpenChatMenu(player, commanderMenu);


public abstract class StateCommanderFunction : CommanderFunction
{
    public bool ConVarState { get; protected set; }
    public abstract List<string>? ConVars { get; protected set; }
    
    [GameEventHandler]
    public virtual HookResult OnRoundStart(EventRoundStart @event, GameEventInfo info)
    {
        ConVarState = false;

        if (ConVars == null) return HookResult.Continue;

        foreach (var conVar in ConVars)
        {
            ConVar.Find(conVar)!.SetValue(ConVarState);
        }

        return HookResult.Continue;
    }

    protected StateCommanderFunction(JailBreak jailBreak) : base(jailBreak)
    {
    }
}

public class ColorCommand : CommanderFunction
{
    public override string Name { get; protected set; } = "Division of color";
    public override bool PlayersChoice { get; protected set; } = false;

    private bool _divisionStatus = false;

    public override void OnSelect(CCSPlayerController commander, CCSPlayerController inmate = null!)
    {
        _divisionStatus = !_divisionStatus;

        var inmates = Utilities.GetPlayers().Where(player => player.Team == CsTeam.Terrorist).ToList();

        for (var i = 0; i < inmates.Count; i++)
        {
            var player = inmates[i];
            player.PlayerPawn.Value!.Render = _divisionStatus
                ? i % 2 == 0 ? Color.Red : Color.Blue
                : player.PlayerPawn.Value!.Render = Color.White;

            Utilities.SetStateChanged(player.PlayerPawn.Value, "CBaseModelEntity", "m_clrRender");
        }
    }

    public ColorCommand(JailBreak jailBreak) : base(jailBreak)
    {
    }
}

public class FreeDayCommand : StateCommanderFunction
{
    public override string Name { get; protected set; } = "Free Day";
    public override bool PlayersChoice { get; protected set; } = false;
    public override List<string>? ConVars { get; protected set; }


    public FreeDayCommand(JailBreak jailBreak) : base(jailBreak)
    {
        VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre);
    }

    private HookResult OnTakeDamage(DynamicHook arg)
    {
        var dmgInfo = arg.GetParam<CTakeDamageInfo>(1);

        var attacker = dmgInfo.Attacker.Value?.As<CCSPlayerPawn>().Controller.Value?.As<CCSPlayerController>();
        if (attacker == null || !attacker.IsValid)
            return HookResult.Continue;

        var userId = arg.GetParam<CCSPlayerPawn>(0);

        if (userId.TeamNum != (int)CsTeam.CounterTerrorist || attacker.Team != CsTeam.Terrorist)
            return HookResult.Continue;


        return ConVarState ? HookResult.Handled : HookResult.Continue;
    }


    public override void OnSelect(CCSPlayerController commander, CCSPlayerController inmate = null!)
    {
        ConVarState = !ConVarState;
        commander.PrintToChat($"Free Day: {ConVarState}");
        var inmates = Utilities.GetPlayers().Where(player => player.Team == CsTeam.Terrorist);

        foreach (var player in inmates)
        {
            player.PlayerPawn.Value!.Render = ConVarState ? Color.Green : Color.White;
            Utilities.SetStateChanged(player.PlayerPawn.Value, "CBaseModelEntity", "m_clrRender");
        }
    }
}

public abstract class StateCommanderFunction : CommanderFunction
{
    public bool ConVarState { get; protected set; }
    public abstract List<string>? ConVars { get; protected set; }
    
    [GameEventHandler]
    public virtual HookResult OnRoundStart(EventRoundStart @event, GameEventInfo info)
    {
        ConVarState = false;

        if (ConVars == null) return HookResult.Continue;

        foreach (var conVar in ConVars)
        {
            ConVar.Find(conVar)!.SetValue(ConVarState);
        }

        return HookResult.Continue;
    }

    protected StateCommanderFunction(JailBreak jailBreak) : base(jailBreak)
    {
    }
}

Как можно сделать лучше?