From 7617802f48b0093a56833e76caf6454f10c54f35 Mon Sep 17 00:00:00 2001 From: cloudbells Date: Fri, 16 Apr 2021 03:29:28 +0200 Subject: [PATCH] Stop logging when exiting desired map IDs --- AutoLoggerClassic.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/AutoLoggerClassic.lua b/AutoLoggerClassic.lua index 32d4b46..4bcc898 100644 --- a/AutoLoggerClassic.lua +++ b/AutoLoggerClassic.lua @@ -9,6 +9,7 @@ local Y_SPACING = -25 local BUTTONS_PER_ROW = 3 -- Variables. +local hasInitialized = false -- true if init has been called. local minimapIcon = LibStub("LibDBIcon-1.0") local buttons = {} local raids = { @@ -157,9 +158,11 @@ function AutoLoggerClassic_OnEvent(self, event, ...) elseif event == "RAID_INSTANCE_WELCOME" then toggleLogging() elseif event == "PLAYER_ENTERING_WORLD" then - init() - AutoLoggerClassicFrame:Hide() + if not hasInitialized then + init() + AutoLoggerClassicFrame:Hide() + hasInitialized = true + end toggleLogging() - self:UnregisterEvent("PLAYER_ENTERING_WORLD") end end