-- Function to hide the Objective Tracker and all its child elements
local function HideObjectiveTracker()
    local success = pcall(function()
        if ObjectiveTrackerFrame then
            ObjectiveTrackerFrame:UnregisterAllEvents() -- Unregister all events linked to the tracker
            ObjectiveTrackerFrame:Hide() -- Hide the tracker frame

            ObjectiveTrackerFrame:SetScript("OnShow", function(self)
                self:Hide() -- Prevent it from showing again
            end)

            print("SYAM Tracker: Objective, Campaign, and Quest Trackers has been successfully hidden.")
        else
            print("ObjectiveTrackerFrame does not exist. Cannot hide the tracker.")
        end
    end)

    if not success then
        print("An error occurred while trying to hide the Objective Tracker.")
    end
end

local frame = CreateFrame("Frame")
frame:RegisterEvent("PLAYER_LOGIN")
frame:SetScript("OnEvent", function(self, event)
    if event == "PLAYER_LOGIN" then
        HideObjectiveTracker()
    end
end)
