コード例 #1
0
ファイル: ClientEvent.cs プロジェクト: TheaP/c-raft
 private void OnPlayerCommand(ClientCommandEventArgs e)
 {
     foreach (EventListener bl in Plugins)
     {
         IPlayerListener pl = (IPlayerListener)bl.Listener;
         if (bl.Event == Event.PlayerCommand)
             pl.OnPlayerCommand(e);
     }
 }
コード例 #2
0
 public void OnPlayerPreCommand(ClientCommandEventArgs e)
 {
 }
コード例 #3
0
ファイル: Client.Actions.cs プロジェクト: Nirad/c-raft
        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);
            }
        }