Change this line
Lua Code:
em:RegisterForEvent(EVENT_EXPERIENCE_GAIN, function(...) OnXPGain(...) end)
to this
Lua Code:
em:RegisterForEvent("XPTracker", EVENT_EXPERIENCE_GAIN, function(...) OnXPGain(...) end)
/edit: because you're registering your event using the event manager and not on your addon object itself.