Skip to content

fix: make the mob goal type cache thread-safe - #522

Open
PluginsKers wants to merge 1 commit into
PaperMC:ver/26.2.xfrom
PluginsKers:fix/mob-goal-cache-thread-safety-v2
Open

PluginsKers wants to merge 1 commit into
PaperMC:ver/26.2.xfrom
PluginsKers:fix/mob-goal-cache-thread-safety-v2

Conversation

@PluginsKers

Copy link
Copy Markdown

MobGoalHelper shares GENERIC_TYPE_CACHE across region threads. Concurrent calls to computeIfAbsent can throw ConcurrentModificationException while a plugin enumerates or removes mob goals, aborting goal setup.

Use ConcurrentHashMap so goal type lookups can safely populate the shared cache.

AI tools were used to implement and review the change and write this description.

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.

1 participant