/// <summary> Hooks IRC events so they are handled. </summary> public void Hook() { if (hookedEvents) { return; } hookedEvents = true; OnPlayerActionEvent.Register(HandlePlayerAction, Priority.Low); OnShuttingDownEvent.Register(HandleShutdown, Priority.Low); OnGroupLoadEvent.Register(HandleGroupLoad, Priority.Low); OnChatEvent.Register(HandleChat, Priority.Low); OnChatSysEvent.Register(HandleChatSys, Priority.Low); OnChatFromEvent.Register(HandleChatFrom, Priority.Low); // Regster events for incoming bot.connection.Listener.OnNick += Listener_OnNick; bot.connection.Listener.OnRegistered += Listener_OnRegistered; bot.connection.Listener.OnAction += Listener_OnAction; bot.connection.Listener.OnPublic += Listener_OnPublic; bot.connection.Listener.OnPrivate += Listener_OnPrivate; bot.connection.Listener.OnError += Listener_OnError; bot.connection.Listener.OnQuit += Listener_OnQuit; bot.connection.Listener.OnJoin += Listener_OnJoin; bot.connection.Listener.OnPart += Listener_OnPart; bot.connection.Listener.OnDisconnected += Listener_OnDisconnected; bot.connection.Listener.OnChannelModeChange += Listener_OnChannelModeChange; bot.connection.Listener.OnNames += Listener_OnNames; bot.connection.Listener.OnKick += Listener_OnKick; bot.connection.Listener.OnKill += Listener_OnKill; bot.connection.Listener.OnPrivateNotice += Listener_OnPrivateNotice; }
public override void Load(bool startup) { OnPlayerConnectEvent.Register(ConnectHandler.HandleConnect, Priority.Critical); OnPlayerCommandEvent.Register(ChatHandler.HandleCommand, Priority.Critical); OnPlayerConnectingEvent.Register(ConnectingHandler.HandleConnecting, Priority.Critical); OnJoinedLevelEvent.Register(MiscHandlers.HandleOnJoinedLevel, Priority.Critical); OnPlayerMoveEvent.Register(MiscHandlers.HandlePlayerMove, Priority.Critical); OnPlayerClickEvent.Register(MiscHandlers.HandlePlayerClick, Priority.Critical); OnEcoTransactionEvent.Register(EcoHandlers.HandleEcoTransaction, Priority.Critical); OnModActionEvent.Register(ModActionHandler.HandleModAction, Priority.Critical); OnGroupLoadEvent.Register(MiscHandlers.HandleGroupLoad, Priority.Critical); clearTask = Server.Background.QueueRepeat(IPThrottler.CleanupTask, null, TimeSpan.FromMinutes(10)); }