Preload item effect files
We already emit onBeforeGetItemEffectList
to get a list of paths, but itemEffects.get
only returns the path and then inventory
requires the file later. Instead, we could read config/itemEffects
and add all those paths, then load each effect into an object to be accessed later.
inventory.hookItemEvents
's error message can be misleading if there's a syntax error in the effect file or onGetText
errors, since that's also inside the try/catch (see here). If we imported them when the server starts, we would get syntax errors immediately without having to trigger hookItemEffects
.
I don't think that the overhead of keeping them around is an issue.
@BigBadWaffle thoughts? There's probably multiple places we could make this sort of change, like when getting status effects too