Beispiel #1
0
        public void ProcessCommand(MsgConCmd message)
        {
            string      text   = message.Text;
            INetChannel sender = message.MsgChannel;
            var         args   = new List <string>();

            CommandParsing.ParseArguments(text, args);

            if (args.Count == 0)
            {
                return;
            }
            string cmd = args[0];

            try
            {
                IClientCommand command = AvailableCommands[cmd];
                args.RemoveAt(0);
                command.Execute(this, sender, args.ToArray());
            }
            catch (KeyNotFoundException)
            {
                SendConsoleReply(string.Format("Unknown command: '{0}'", cmd), sender);
            }
            catch (Exception e)
            {
                SendConsoleReply(string.Format("There was an error while executing the command: {0}", e.Message), sender);
            }
        }
Beispiel #2
0
        public void ProcessCommand(MsgConCmd message)
        {
            var text    = message.Text;
            var sender  = message.MsgChannel;
            var session = _players.GetSessionByChannel(sender);
            var args    = new List <string>();

            Logger.Info($"[{(int)session.Index}]{session.Name}:{text}");

            CommandParsing.ParseArguments(text, args);

            if (args.Count == 0)
            {
                return;
            }
            var cmd = args[0];

            try
            {
                if (availableCommands.TryGetValue(cmd, out var command))
                {
                    args.RemoveAt(0);
                    command.Execute(this, session, args.ToArray());
                }
                else
                {
                    SendConsoleReply(sender, $"Unknown command: '{cmd}'");
                }
            }
            catch (Exception e)
            {
                SendConsoleReply(sender, $"There was an error while executing the command: {e.Message}");
            }
        }
Beispiel #3
0
        private void ProcessCommand(MsgConCmd message)
        {
            string?text = message.Text;

            LogManager.GetSawmill(SawmillName).Info($"SERVER:{text}");

            ExecuteCommand(null, text);
        }
Beispiel #4
0
        private void ProcessCommand(MsgConCmd message)
        {
            string?text    = message.Text;
            var    sender  = message.MsgChannel;
            var    session = _players.GetSessionByChannel(sender);

            LogManager.GetSawmill(SawmillName).Info($"{FormatPlayerString(session)}:{text}");

            ExecuteCommand(session, text);
        }