示例#1
0
 public virtual void OnPlayerPreCommand(ClientCommandEventArgs e)
 {
 }
示例#2
0
        private void CommandProc(string raw, string[] tokens)
        {
            ClientCommand cmd;
            try
            {
                cmd = _Player.Server.ClientCommandHandler.Find(tokens[0]) as ClientCommand;
            }
            catch (CommandNotFoundException e)
            {
                SendMessage(ChatColor.Red + e.Message);
                return;
            }
            try
            {
                //Event
                ClientCommandEventArgs e = new ClientCommandEventArgs(this, cmd, tokens);
                _Player.Server.PluginManager.CallEvent(Event.PLAYER_COMMAND, e);
                if (e.EventCanceled) return;
                tokens = e.Tokens;
                //End Event

                cmd.Use(this, tokens);
            }
            catch (Exception e)
            {
                SendMessage("There was an error while executing the command.");
                _Player.Server.Logger.Log(e);
            }
        }
示例#3
0
        private void CommandProc(string commandName, string raw, string[] tokens)
        {
            var cleanedTokens = tokens.Skip(1).ToArray();
            IClientCommand cmd;
            try
            {
                cmd = _player.Server.ClientCommandHandler.Find(commandName) as IClientCommand;
            }
            catch (CommandNotFoundException e)
            {
                SendMessage(ChatColor.Red + e.Message);
                return;
            }
            try
            {
                //Event
                ClientCommandEventArgs e = new ClientCommandEventArgs(this, cmd, cleanedTokens);
                _player.Server.PluginManager.CallEvent(Event.PlayerCommand, e);
                if (e.EventCanceled) return;
                cleanedTokens = e.Tokens;
                //End Event

                cmd.Use(this, commandName, cleanedTokens);
            }
            catch (Exception e)
            {
                SendMessage("There was an error while executing the command.");
                _player.Server.Logger.Log(e);
            }
        }
示例#4
0
 private void OnPlayerPreCommand(ClientCommandEventArgs e)
 {
     foreach (EventListener bl in Plugins)
     {
         PlayerListener pl = (PlayerListener)bl.Listener;
         if (bl.Event == Event.PLAYER_PRE_COMMAND)
             pl.OnPlayerPreCommand(e);
     }
 }
示例#5
0
 private void OnPlayerCommand(ClientCommandEventArgs e)
 {
     foreach (EventListener bl in Plugins)
     {
         PlayerListener pl = (PlayerListener)bl.Listener;
         if (bl.Event == Event.PlayerCommand)
             pl.OnPlayerCommand(e);
     }
 }