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