Skip to content

Use ExpansionType check for persistence#1071

Open
Andre601 wants to merge 3 commits into
masterfrom
feature/add-internal-expansion-check
Open

Use ExpansionType check for persistence#1071
Andre601 wants to merge 3 commits into
masterfrom
feature/add-internal-expansion-check

Conversation

@Andre601
Copy link
Copy Markdown
Collaborator

@Andre601 Andre601 commented Jul 7, 2024

Pull Request

Type

  • Internal change (Doesn't affect end-user).
  • External change (Does affect end-user).
  • Wiki (Changes towards the Wiki).
  • Other: __________

Description

Closes N/A

PlaceholderAPI is still solely relying on the persist() boolean method to check if an expansion should be unregistered or not.
And as prooven by #1070 is this a faulty aproach, as a dev missing the override or not setting it to return true can cause an internal expansion to unregister and not register again due to it being internal.

Since we now have an Enum to set an expansion's type to be either Internal (Default) or external, is there no need for this extra method to be needed, hence why this PR deprecates it and updates the expansion manager to check not only for persist() being true, but also for when it is marked internal.

This also adds a warning for the case where an expansion is marked external, but has persist() return true, which it should never be.

Comment thread src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java Outdated
Comment thread src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java Outdated
@Andre601 Andre601 mentioned this pull request Sep 25, 2024
4 tasks
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.

3 participants