Ejemplo n.º 1
0
        /// <summary>
        ///     Registers a command to the list of commands properly
        /// </summary>
        /// <param name="command">Name of the command to register</param>
        /// <param name="cdesc">Description</param>
        /// <param name="args">Arguments (these are purely for viewing so that a user can see what an argument needs to be)</param>
        /// <returns></returns>
        public static Command RegisterCommand(string command, string cdesc, string[] args = null)
        {
            var c = new Command(command, cdesc, args);
            if (RegisteredCommands.Contains(c))
            {
                Log.AsyncR($"Command already registered! [{c.CommandName}]");
                return RegisteredCommands.Find(x => x.Equals(c));
            }

            RegisteredCommands.Add(c);
            Log.Async("Registered command: " + command);

            return c;
        }