Exemplo n.º 1
0
 private void OnPlayerCommand(ClientCommandEventArgs e)
 {
     foreach (EventListener bl in Plugins)
     {
         IPlayerListener pl = (IPlayerListener)bl.Listener;
         if (bl.Event == Event.PlayerCommand)
             pl.OnPlayerCommand(e);
     }
 }
Exemplo n.º 2
0
 public void OnPlayerPreCommand(ClientCommandEventArgs e)
 {
 }
Exemplo n.º 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);
            }
        }