Beispiel #1
0
        void Listener_OnPrivate(UserInfo user, string message)
        {
            if (!Server.ircControllers.Contains(user.Nick))
            {
                Pm(user.Nick, "You are not an IRC controller!"); return;
            }
            if (message.Split(' ')[0] == "resetbot" || banCmd.Contains(message.Split(' ')[0]))
            {
                Pm(user.Nick, "You cannot use this command from IRC!"); return;
            }
            if (Player.CommandHasBadColourCodes(null, message))
            {
                Pm(user.Nick, "Your command had invalid color codes!"); return;
            }

            Command cmd = Command.all.Find(message.Split(' ')[0]);

            if (cmd != null)
            {
                Server.s.Log("IRC Command: /" + message);
                usedCmd = user.Nick;
                try { cmd.Use(null, message.Split(' ').Length > 1 ? message.Substring(message.IndexOf(' ')).Trim() : ""); }
                catch { Pm(user.Nick, "Failed command!"); }
                usedCmd = "";
            }
            else
            {
                Pm(user.Nick, "Unknown command!");
            }
        }