Hi, i have an Idea @imthenewguy
I’m running a custom plugin called SkillTreeXPScheduler, which applies temporary XP bonuses (e.g. +50% XP events).
Previously, I used the hook:
STCanGainXP(BasePlayer player, BaseEntity source, double value, string sourceString)
to modify XP like this:
private object STCanGainXP(BasePlayer player, BaseEntity source, double value, string sourceString) { if (_activeEvent == null) return null; if (!IsMatchingScope(sourceString, _currentScopeKey)) return null; return value * _currentFactor; // e.g. 1.5 for +50% }
This worked fine before.
After updating to v1.7.7, the behavior changed:
As soon as my event becomes active → no XP is granted at all
When the event is inactive → XP works normally
After debugging, the reason became clear:
var hook = Interface.CallHook("STCanGainXP", player, source, value, source_string); if (hook != null) return;
Since the hook now returns object and any non-null value cancels XP,
my plugin unintentionally blocks XP entirely instead of modifying it.
So effectively:
Old behavior: return double → modify XP
New behavior: return anything → cancel XP
I’ve now switched to using:
OnXpGain(..., List<double> mods)
which works correctly for scaling XP.
However, this is a breaking change that can silently break existing plugins like mine, especially those that were designed to scale XP via STCanGainXP.
I suspect this affects many plugins developed for scaling XP via STCanGainXP.
All of these could be causing the problem.
Perhaps this will help you. I had ChatGPT write it.