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
feat(platform): add clear methods to remove the audience provider cache #65
Conversation
this is not an audience cache, this is an imo the correct solution is to make the |
Mmh but shouldn't Maybe rename it to |
I have built a workaround in my testing library in the mean time: Field instances = Class.forName("net.kyori.adventure.platform.bukkit.BukkitAudiencesImpl").getDeclaredField("INSTANCES");
instances.setAccessible(true);
((Map<String, BukkitAudiences>) instances.get(null)).clear(); Should this API addition still be added or should I close the PR and the users who need to clear the cache use the reflection code above? |
I might be missing something, but why can't you just clear the instance from the static map when the existing close method is called? |
No you are right, I am the one that missed something ;) |
Ok I updated the PR so that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me now!
Added
[...]Audiences.clear()
and[...]Audiences.clear(Plugin)
to all three audiences. This will remove the audience from the static cache. This functionality may be needed by test environments.This is related to this request on discord.