From 0a234de375f83257276955cab589120c996b25d1 Mon Sep 17 00:00:00 2001 From: Tercioo Date: Thu, 7 Mar 2019 17:49:46 -0300 Subject: [PATCH] - Fixed plugins initialization broken in latest version. --- boot.lua | 6 +++--- core/plugins.lua | 13 ++++++++++--- plugins/Details_TinyThreat/Details_TinyThreat.lua | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/boot.lua b/boot.lua index 7ac50aca..060d33bf 100644 --- a/boot.lua +++ b/boot.lua @@ -4,11 +4,11 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.build_counter = 6923 - _detalhes.alpha_build_counter = 6923 --if this is higher than the regular counter, use it instead + _detalhes.build_counter = 6924 + _detalhes.alpha_build_counter = 6924 --if this is higher than the regular counter, use it instead _detalhes.game_version = "v8.1.0" _detalhes.userversion = "v8.1.0." .. _detalhes.build_counter - _detalhes.realversion = 136 --core version, this is used to check API version for scripts and plugins (see alias below) + _detalhes.realversion = 137 --core version, this is used to check API version for scripts and plugins (see alias below) _detalhes.APIVersion = _detalhes.realversion --core version _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" --simple stirng to show to players diff --git a/core/plugins.lua b/core/plugins.lua index ba86da2b..67ed0f61 100644 --- a/core/plugins.lua +++ b/core/plugins.lua @@ -284,11 +284,17 @@ local NewPlugin = {__options = PluginOptions, __enabled = true, RegisterEvent = register_event_func, UnregisterEvent = unregister_event_func} local Frame = CreateFrame ("Frame", FrameName, UIParent) - Frame:RegisterEvent ("ADDON_LOADED") + Frame:RegisterEvent ("PLAYER_LOGIN") Frame:RegisterEvent ("PLAYER_LOGOUT") - Frame:SetScript ("OnEvent", function(event, ...) + + Frame:SetScript ("OnEvent", function(self, event, ...) if (NewPlugin.OnEvent) then - return NewPlugin:OnEvent (event, ...) + if (event == "PLAYER_LOGIN") then + NewPlugin:OnEvent (self, "ADDON_LOADED", NewPlugin.Frame:GetName()) + NewPlugin.Frame:Hide() + return + end + return NewPlugin:OnEvent (self, event, ...) end end) @@ -634,6 +640,7 @@ --> a plugin request to be embed into the main plugin window function f.EmbedPlugin (pluginObject, frame, isUtility) + --> check if the plugin has a frame if (not pluginObject.Frame) then f.DebugMsg ("plugin doesn't have a frame.") diff --git a/plugins/Details_TinyThreat/Details_TinyThreat.lua b/plugins/Details_TinyThreat/Details_TinyThreat.lua index f33f1a83..2411583d 100644 --- a/plugins/Details_TinyThreat/Details_TinyThreat.lua +++ b/plugins/Details_TinyThreat/Details_TinyThreat.lua @@ -20,7 +20,7 @@ local _math_abs = math.abs local RAID_CLASS_COLORS = RAID_CLASS_COLORS --> Create the plugin Object -local ThreatMeter = _detalhes:NewPluginObject ("Details_Threat") +local ThreatMeter = _detalhes:NewPluginObject ("Details_TinyThreat") --> Main Frame local ThreatMeterFrame = ThreatMeter.Frame