Run player cleanup after realm entry

This commit is contained in:
Dusk-92
2026-09-01 14:26:56 +02:00
parent a5b4d21f55
commit 003915bbcb
+8 -3
View File
@@ -175,16 +175,21 @@ end
HookChatColors()
module.enable = function(self)
local playerdb, realmdb = GetPlayerCache()
CleanupPlayerDB(playerdb, realmdb)
-- Defensive second call for chat frames created/replaced by another addon
-- between file load and VARIABLES_LOADED. Existing hooks are never duplicated.
HookChatColors()
local socialmod = CreateFrame("Frame", "ShaguTweaksSocialMod", UIParent)
socialmod:RegisterEvent("PLAYER_ENTERING_WORLD")
socialmod:RegisterEvent("CHAT_MSG_SYSTEM")
socialmod:SetScript("OnEvent", function()
if event == "PLAYER_ENTERING_WORLD" then
local playerdb, realmdb = GetPlayerCache()
CleanupPlayerDB(playerdb, realmdb)
this:UnregisterEvent("PLAYER_ENTERING_WORLD")
return
end
local currentdb = GetPlayerCache()
local name = cmatch(arg1, _G.ERR_FRIEND_ONLINE_SS) or cmatch(arg1, _G.ERR_FRIEND_OFFLINE_S)
if name and currentdb[name] then