Skip to content

Simplify Folia check to allow greater fork compatibility - #2319

Open
NahuLD wants to merge 5 commits into
EngineHub:version/7.0.xfrom
LemonGamingLtd:version/7.0.x
Open

NahuLD wants to merge 5 commits into
EngineHub:version/7.0.xfrom
LemonGamingLtd:version/7.0.x

Conversation

@NahuLD

@NahuLD NahuLD commented Oct 22, 2026

Copy link
Copy Markdown

The Folia check currently only works when you run the official Folia Paper fork from the PaperMC team.

This simplifies it and simply checks for an existing class from upstream which would encompass all Folia forks and is pretty standard across all Folia compatible plugins.

This change has been tested and is currently live in our production servers. Feel free to request any changes or ask any questions that may arise!

@me4502 me4502 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I've left a comment, we had a change lined up for the Folia check to delegate to WorldEdit's, so that we didn't need to keep multiple plugins up to date as we chase various forks around.

@NahuLD
NahuLD requested a review from me4502 October 23, 2026 10:59
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
// Folia is Paper-based, so this is a good first check.
if (PaperLib.isPaper()) {
return ServerBuildInfo.buildInfo().isBrandCompatible(net.kyori.adventure.key.Key.key("papermc", "folia"));
return getWorldEdit().isFolia(); // Delegate check to WorldEdit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Paper check is handled by WorldEdit so we can likely bring this up another level. It's also realistically safe to do this without the try/catch as WorldEdit also handles errors, and there shouldn't be any case where someone runs this WG version against an earlier WorldEdit (due to MC version support not overlapping)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the try/catch because WorldGuardPlugin#getWorldEdit throws CommandException in case the plugin is not installed or enabled at the time of call. I do however agree that the PaperLib#isPaper check is quite superfluous since that is already done by WorldEdit.

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