1. PLAYER_ENTERING_WORLD does not fire when you change zones. It only fires after you see a login screen, so it fires when you log in, reload the UI, enter an instance, leave an instance, or change continents (eg. take a zeppelin or boat through a loading screen). If you want to detect when the player changes zones, you need to register for ZONE_CHANGED_NEW_AREA, ZONE_CHANGED, and/or ZONE_CHANGED_INDOORS. See the
map events page on Wowpedia for a description of each event.
2. If you still believe you're seeing issues with AceEvent-3.0 and PLAYER_ENTERING_WORLD, try using a simple test addon with debug prints to see what's going on:
Lua Code:
local addon = LibStub("AceAddon-3.0"):NewAddon("ToggleTestAddon", "AceEvent-3.0")
function addon:OnInitialize()
print("OnInitialize")
self:RegisterEvent("PLAYER_ENTERING_WORLD")
-- Normally you would only register events in OnEnable, and then
-- disable them in OnDisable, but for this test we want the event
-- to always be registered regardless of the addon's enabled state.
end
function addon:OnEnable()
print("OnEnable")
end
function addon:OnDisable()
print("OnDisable")
end
function addon:PLAYER_ENTERING_WORLD()
print("PLAYER_ENTERING_WORLD", self:IsEnabled() and "enabled" or "disabled")
end
function addon:Toggle()
print("Toggle")
if self:IsEnabled() then
print("Disable")
self:Disable()
else
print("Enable")
self:Enable()
end
end
SLASH_TOGGLETEST1 = "/toggletest"
SlashCmdList.TOGGLETEST = function() return addon:Toggle() end
Type "/toggletest" in-game to toggle the enabled state of the test addon. Watch for debug messages in the chat frame when the addon is loaded, enabled, or disabled; and whenever the PLAYER_ENTERING_WORLD event fires. Try zoning in and out of an instance a few times with the addon enabled, then again a few times with it disabled.
If the test addon works as expected (eg. always receives the event) then there is something wrong in your code, and you will need to post your full code if you want any further help with the problem.
If it does
not work as expected, report back with a description of its behavior.