update LibElvUIPlugin

This commit is contained in:
Crum
2018-01-21 21:34:46 -06:00
parent ed64ac7202
commit 8d353ec83b
@@ -5,7 +5,7 @@ if not lib then return end
--Cache global variables
--Lua functions
local pairs, tonumber = pairs, tonumber
local format, gsub, strmatch, strsplit = string.format, string.gsub, string.match, string.split
local format, gsub, strmatch, strsplit = format, gsub, strmatch, strsplit
--WoW API / Variables
local CreateFrame = CreateFrame
local GetAddOnMetadata = GetAddOnMetadata
@@ -85,8 +85,8 @@ function lib:RegisterPlugin(name,callback, isLib)
if not lib.ConfigFrame then
local configFrame = CreateFrame("Frame")
configFrame:RegisterEvent("ADDON_LOADED")
configFrame:SetScript("OnEvent", function(self, event, addon)
if addon == "ElvUI_Config" then
configFrame:SetScript("OnEvent", function()
if arg1 == "ElvUI_Config" then
for _, PlugIn in pairs(lib.plugins) do
if PlugIn.callback then
PlugIn.callback()
@@ -147,17 +147,17 @@ local function SendPluginVersionCheck(self)
end
end
function lib:VersionCheck(event, prefix, message, channel, sender)
function lib:VersionCheck()
if not ElvUI[1].global.general.versionCheck then return end
local E = ElvUI[1]
if event == "CHAT_MSG_ADDON" then
if not (prefix == lib.prefix and sender and message and not strmatch(message, "^%s-$")) then return end
if sender == E.myname then return end
if not (arg1 == lib.prefix and arg4 and arg1 and not strmatch(arg1, "^%s-$")) then return end
if arg4 == E.myname then return end
if not E["pluginRecievedOutOfDateMessage"] then
local name, version, plugin, Pname
for _, p in pairs({strsplit(";",message)}) do
for _, p in pairs({strsplit(";", arg2)}) do
if not strmatch(p, "^%s-$") then
name, version = strmatch(p, "([%w_]+)=([%d%p]+)")
if lib.plugins[name] then
@@ -212,7 +212,7 @@ function lib:GeneratePluginList()
end
function lib:SendPluginVersionCheck(message)
if (not message) or strmatch(message, "^%s-$") then return end
if not message or strmatch(message, "^%s-$") then return end
local ChatType
if GetNumRaidMembers() > 1 then
@@ -231,7 +231,7 @@ function lib:SendPluginVersionCheck(message)
splitMessage = strmatch(strsub(message, 1, maxChar), ".+;")
if splitMessage then -- incase the string is over `maxChar` but doesnt contain `;`
message = gsub(message, "^"..gsub(splitMessage, '([%-%.%+%[%]%(%)%$%^%%%?%*])','%%%1'), "")
message = gsub(message, "^"..gsub(splitMessage, "([%-%.%+%[%]%(%)%$%^%%%?%*])","%%%1"), "")
ElvUI[1]:Delay(delay, SendAddonMessage, lib.prefix, splitMessage, ChatType)
delay = delay + 1
end