Skip to content

Conversation

@nebel
Copy link
Contributor

@nebel nebel commented Apr 18, 2025

Unfortunately the last fix was not enough to due ConfigHolder.GetOrDefault also depending on the current name. To prevent this I pull the name from NameHandlerCache instead (which is safe on any thread) while allowing the name to default to "" if unavailable. Then in the settings window there's a bunch of defensive code to make sure the player exists first and if so, load the real name in there.

@nebel
Copy link
Contributor Author

nebel commented Apr 18, 2025

I also have a more aggressive refactoring which builds on top of this branch, and manages hook activation/deactivation according to the login state so that hooks will no longer even run when logged out. As part of this I moved all hooks to handlers similar to LuaHandler (so NameHandlerCache gets its hooks moved in and becomes StringHandler for example). And each handles its own init/activation/deactivation based on the login state.

I understand that might be too ambitious for a bug fix though, so I didn't PR it, but let me know if I should: nebel/PrefPro@nebel:PrefPro:more-defensive-name-handling...nebel:PrefPro:refactor-hook-activation

@Haselnussbomber Haselnussbomber mentioned this pull request Apr 18, 2025
@perchbirdd perchbirdd merged commit 09490f7 into perchbirdd:main Aug 7, 2025
1 check passed
@perchbirdd
Copy link
Owner

Thank you for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants