Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Essentials#getUser not caching newly created NPC users #5129

Merged
merged 2 commits into from
Oct 11, 2022

Conversation

JRoy
Copy link
Member

@JRoy JRoy commented Oct 11, 2022

Essntials#getUser originally calls UserMap#getUser to try and fetch a user from the cache (or get an actual CraftPlayer), and if that returns null, it will call UserMap#loadUncachedUser which will create a new User object but not load it into cache. Since Essentials#getUser calls UserMap#getUser which has the behavior of loading a User object into cache anyway, we need to emulate that behavior manually when it comes to NPC accounts otherwise we end up creating an NPC user object every time it's looked up (which could be when it teleports or its punched from JailListener)

@JRoy JRoy added type: bugfix PRs that fix bugs in EssentialsX. module: main Issues or PRs for the main Essentials module labels Oct 11, 2022
@JRoy JRoy added this to the 2.20.0 milestone Oct 11, 2022
@JRoy JRoy enabled auto-merge (squash) October 11, 2022 00:36
@JRoy JRoy merged commit e91ce0c into EssentialsX:2.x Oct 11, 2022
@JRoy JRoy deleted the fix/npc-usermap-whatface branch October 11, 2022 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: main Issues or PRs for the main Essentials module type: bugfix PRs that fix bugs in EssentialsX.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants