The event is "ADDON_LOADED" and the name of the addon that just loaded would be "Blizzard_AzeriteEssenceUI"
Code:
local EventFrame = CreateFrame('Frame', nil, UIParent)
EventFrame:RegisterEvent('ADDON_LOADED')
EventFrame:SetScript('OnEvent', function(self, event, name)
if name == 'Blizzard_AzeriteEssenceUI' then
--AzeriteEssenceUI
local MAEU = AzeriteEssenceUI
MAEU.ClearAllPoints = function() end
MAEU:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOM", 45, -5)
MAEU.SetPoint = function() end
MAEU:SetMovable(true)
MAEU:SetUserPlaced(true)
MAEU:SetClampedToScreen(true)
local MoveAzeriteEssenceUI = CreateFrame("Frame", nil, MAEU)
MoveAzeriteEssenceUI:SetHeight(15)
MoveAzeriteEssenceUI:ClearAllPoints()
MoveAzeriteEssenceUI:SetPoint("TOPLEFT", MAEU)
MoveAzeriteEssenceUI:SetPoint("TOPRIGHT", MAEU)
MoveAzeriteEssenceUI:EnableMouse(true)
MoveAzeriteEssenceUI:SetHitRectInsets(-5, -5, -5, -5)
MoveAzeriteEssenceUI:RegisterForDrag("LeftButton")
MoveAzeriteEssenceUI:SetScript("OnDragStart", function(self, button)
if button=="LeftButton" and IsModifiedClick()then
MAEU:StartMoving()
end
end)
MoveAzeriteEssenceUI:SetScript("OnDragStop", function(self, button)
MAEU:StopMovingOrSizing()
end)
--AzeriteEssenceUI
end
end)
Since you only register one event you don't need to check which event triggered the OnEvent script.