Skip to content

Commit

Permalink
Fix an issue with the DB resetting.
Browse files Browse the repository at this point in the history
  • Loading branch information
funkydude committed Oct 27, 2016
1 parent 65c51a6 commit 1a4f546
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions BadBoy.lua
Original file line number Diff line number Diff line change
@@ -927,21 +927,16 @@ end
--[[ Blacklist ]]--
do
local f = CreateFrame("Frame")
f:RegisterEvent("ADDON_LOADED")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function(frame, event, addon)
if addon == "BadBoy" then
-- Blacklist DB setup, needed since Blizz nerfed ReportPlayer so hard the block sometimes only lasts a few minutes.
local _, _, day = CalendarGetDate()
if type(BADBOY_BLACKLIST) ~= "table" or BADBOY_BLACKLIST.dayFromCal ~= day then
BADBOY_BLACKLIST = {dayFromCal = day}
end
frame:UnregisterEvent(event)
elseif event == "PLAYER_LOGIN" then
SetCVar("spamFilter", 1)
frame:UnregisterEvent(event)
frame:SetScript("OnEvent", nil)
f:RegisterEvent("PLAYER_LOGIN") -- Can't use ADDON_LOADED as CalendarGetDate isn't always ready on very first login.
f:SetScript("OnEvent", function(frame, event)
-- Blacklist DB setup, needed since Blizz nerfed ReportPlayer so hard the block sometimes only lasts a few minutes.
local _, _, day = CalendarGetDate()
if type(BADBOY_BLACKLIST) ~= "table" or BADBOY_BLACKLIST.dayFromCal ~= day then
BADBOY_BLACKLIST = {dayFromCal = day}
end
SetCVar("spamFilter", 1)
frame:UnregisterEvent(event)
frame:SetScript("OnEvent", nil)
end)
end

0 comments on commit 1a4f546

Please sign in to comment.