Skip to content

Commit

Permalink
- Fixing additional race conditions on event firing and solving an is…
Browse files Browse the repository at this point in the history
…sue with guild events not being ready at a specific time.
  • Loading branch information
Vapok committed Jun 18, 2020
1 parent 3311b44 commit 235f539
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local L = core.L;
local waitTable = {};
local waitFrame = nil;
local lockouts = CreateFrame("Frame", "LockoutsFrame");
local eventDelay = {};

--------------------------------------
-- Slash Command
Expand Down Expand Up @@ -249,20 +250,29 @@ function MonDKP_OnEvent(self, event, arg1, ...)

if event == "ADDON_LOADED" then
if (arg1 ~= "MonolithDKP") then return end
core.InitStart = false
core.IsOfficer = nil
core.Initialized = false
MonDKP_wait(2, DoInit, event, arg1);
---DoInit(event,arg1);
self:UnregisterEvent("ADDON_LOADED")
return;
end

-- If core.DB is nil, that means that the addon hasn't fully initialized.. so let's wait 1 second and try again.
if core.DB == nil then
C_Timer.After(1, function () MonDKP_OnEvent(self, event, arg1); end);
if eventDelay[event] == nil then
eventDelay[event] = 1;
else
eventDelay[event] = eventDelay[event] + 2;
end
C_Timer.After(eventDelay[event], function () MonDKP_OnEvent(self, event, arg1); end);
return;
end

if eventDelay[event] ~= nil then
eventDelay[event] = nil;
end

-- unregister unneccessary events
if event == "CHAT_MSG_WHISPER" and not core.DB.modes.channels.whisper then
self:UnregisterEvent("CHAT_MSG_WHISPER")
Expand Down Expand Up @@ -341,7 +351,7 @@ function MonDKP_OnEvent(self, event, arg1, ...)
end
end
elseif event == "GUILD_ROSTER_UPDATE" then

if not core.InitStart then
DoGuildUpdate();
end
Expand Down

0 comments on commit 235f539

Please sign in to comment.