/// <summary> Unhooks IRC events so they are no longer handled. </summary> public void Unhook() { if (!hookedEvents) { return; } hookedEvents = false; userMap.Clear(); OnPlayerActionEvent.Unregister(HandlePlayerAction); OnShuttingDownEvent.Unregister(HandleShutdown); OnGroupLoadEvent.Unregister(HandleGroupLoad); OnChatEvent.Unregister(HandleChat); OnChatSysEvent.Unregister(HandleChatSys); OnChatFromEvent.Unregister(HandleChatFrom); // 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 Unload(bool shutdown) { OnPlayerConnectEvent.Unregister(ConnectHandler.HandleConnect); OnPlayerCommandEvent.Unregister(ChatHandler.HandleCommand); OnPlayerConnectingEvent.Unregister(ConnectingHandler.HandleConnecting); OnJoinedLevelEvent.Unregister(MiscHandlers.HandleOnJoinedLevel); OnPlayerMoveEvent.Unregister(MiscHandlers.HandlePlayerMove); OnPlayerClickEvent.Unregister(MiscHandlers.HandlePlayerClick); OnEcoTransactionEvent.Unregister(EcoHandlers.HandleEcoTransaction); OnModActionEvent.Unregister(ModActionHandler.HandleModAction); OnGroupLoadEvent.Unregister(MiscHandlers.HandleGroupLoad); Server.Background.Cancel(clearTask); }