Fix events registration and handling

This commit is contained in:
rilgamon 2021-04-03 16:26:25 +02:00
parent 5e9ad689a8
commit 28161e3070
1 changed files with 4 additions and 2 deletions

View File

@ -92,16 +92,18 @@ child['specs'] = {
}
}
}
local function OnEvent(self, event, ...)
local function OnEvent(lib, self, event, ...)
if(type(events[event])=='function') then
events[event](self,event,...)
else
print("[itemsdb] Failed", ...)
end
end
function child.events:PLAYER_ENTERING_WORLD(event)
child:UnregisterEvent('PLAYER_ENTERING_WORLD')
local list = {}
for event,func in pairs(events) do
if((child:IsClassic() and not db['donthookCraftFrame']) or (not child:IsClassic() and not skipRetail[event])) then
if(child:IsClassic() or (not child:IsClassic() and not skipRetail[event])) then
list[#list+1] = event
end
end