Example #1
0
        internal static void OnServerCommand(string command)
        {
            Arg arg = Arg.FromServer(command);

            if (arg.Invalid)
            {
                ConsoleSystem.LogWarning($"Invalid console command: {command}");
                return;
            }

            if (ListCommandMethods.TryGetValue(arg.Command, out CommandMethod cmdMethod) == false)
            {
                ConsoleSystem.LogWarning($"Unknown console command: {arg.Command}");
                return;
            }

            cmdMethod.Call.Invoke(null, arg);

            if (string.IsNullOrEmpty(arg.Reply) == false)
            {
                ConsoleSystem.Log(arg.Reply);
            }
        }