/// <summary>
        /// Execute a command in the context of the user.
        /// </summary>
        /// <param name="command">The command text, with the slash removed.</param>
        public void ExecuteCommand(string command)
        {
            //Event
            ClientPreCommandEventArgs e = new ClientPreCommandEventArgs(this, command);
            _Player.Server.PluginManager.CallEvent(Event.PLAYER_PRE_COMMAND, e);
            if (e.EventCanceled) return;
            command = e.Command;
            //End Event

            int argsPos = command.IndexOf(" ");
            string baseCommand = command;
            if (argsPos != -1)
                baseCommand = command.Substring(0, command.IndexOf(" "));
            if (!_Player.CanUseCommand(baseCommand))
            {
                SendMessage("You do not have permission to use that command");
                return;
            }
            Logger.Log(Logger.LogLevel.Info, _Player.DisplayName + " issued server command: " + command);
            _Player.Server.Broadcast(_Player.DisplayName + " executed command " + command, this);
            CommandProc(command, Chat.Tokenize(command));
        }
Beispiel #2
0
        /// <summary>
        /// Execute a command in the context of the user.
        /// </summary>
        /// <param name="command">The command text, with the slash removed.</param>
        public void ExecuteCommand(string command)
        {
            //Event
            ClientPreCommandEventArgs e = new ClientPreCommandEventArgs(this, command);
            Server.PluginManager.CallEvent("PLAYER_PRE_COMMAND", e);
            if (e.EventCanceled) return;
            command = e.Command;
            //End Event

            if (!CanUseCommand(command))
            {
                SendMessage("You do not have permission to use that command");
                return;
            }
            Logger.Log(Logger.LogLevel.Info, DisplayName + " issued server command: " + command);
            Server.Broadcast(DisplayName + " executed command " + command, this);
            CommandProc(command, Chat.Tokenize(command));
        }