-
Notifications
You must be signed in to change notification settings - Fork 260
Fix duplicate expansion loading #866
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
Conversation
BlitzOffline
left a comment
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.
The only thing I'd really change is the message.
From Failed to load expansion %s. Identifier is already registered.
To Failed to load expansion %s because another expansion with the same identifier is already registered.
Since the identifier isn't registered, the expansion with that identifier is.
|
Feels a bit wordy... |
|
Request to revert this merge as the actual identifier for the expansion should never be changed. Which in turn causes stuff to break when reloading. |
? |
Do you have proof that reload doesn't work or is just a guess? Iirc the expansions map is cleared on reload. PlaceholderAPI/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java Lines 386 to 388 in e862abe
Edit no.2: |
|
Apologies for the late response. So the issue I'm facing is reloading an expansion (by reloading a plugin - shutting it down and reregistering) while the server is running results in PAPI not being able to reregister is, thus resulting in it erroring out - and since 90% of the plugins do not actually unregister the expansions themselves, this causes issues. As for the reasoning behind this issue in the first place, sounds to be more of an issue with the implementing plugin, rather than this. It should also follow strict naming so |
|
The issue in your case would more be doing stuff that nobody encourages. Reloading the server (or in your case individual plugins) is something no plugin dev would recommend to you. And the issues you describe are one reason why. PlaceholderAPI doesn't monitor plugins that register expansions to then unload them when the plugin itself shuts down. This at most happens with expansions that defined a required plugin (See here). The easiest way to fix this is to simply have the plugin unregister its expansion on disable to then register it again. |
Pull Request
Type
Description
Closes #864
Fixes an issue where the same expansion would be loaded twice, if the jar file used has a slightly different name.
Now PlaceholderAPI checks if the used identifier is already registered and in such a case prints a warning and doesn't load the expansion.