Repository navigation
Use NIO in the YAMLProcessor class - #3715
Merged
Merged
Conversation
* Use NIO in the YAMLProcessor class * Update worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java Co-authored-by: Octavia Togami <octavia.togami@gmail.com> * Update worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java Co-authored-by: Octavia Togami <octavia.togami@gmail.com> * Fix logger not existing * Fix checkstyle --------- Co-authored-by: Octavia Togami <octavia.togami@gmail.com> (cherry picked from commit 5f543fdb779e982f92084934ea8f4af3d1c740e1)
Contributor
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟡 Changes recommended
The change replaces the protected File file field with a Path path field in YAMLProcessor, which is a binary-incompatible API break for external subclasses/plugins and directly conflicts with the stated compatibility goal unless a deprecated alias is retained.
1 open issue
What changed in this PR
This pull request cherry-picks upstream WorldEdit changes to migrate YAMLProcessor from java.io.File-based I/O to NIO (Path/Files) and adds Path constructors, restoring runtime compatibility with integrations (e.g., WorldGuard) that now call YAMLProcessor(Path, ...).
Changes:
- Add
Path-accepting constructors toYAMLProcessorand switch internal read/write operations tojava.nio.file.Filesstreams. - Update Bukkit bootstrap/config initialization to pass
.toPath()forworldedit-config.yml. - Update WEPIF permissions configuration loading to use
Path/FilesAPIs.
Review notes (unresolved):
- Critical: Changing
protected File filetoPath pathis binary-incompatible for external subclasses/plugins accessingYAMLProcessor#file(risk ofNoSuchFieldError). Consider keeping a deprecatedprotected File filealias derived frompathto preserve compatibility. - Moderate:
save()creates anOutputStreamWriterthat is not closed/flushed; this can truncate output while still returningtrue. Use try-with-resources for the writer. - Nit:
save()directory creation/logging should also considerSecurityException, and use parameterized logging instead of string concatenation.
| File | Summary |
|---|---|
worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java |
Adds Path constructors and migrates YAML read/write and directory creation to NIO (Path/Files). |
worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java |
Passes a Path (.toPath()) into YAMLProcessor for Bukkit config initialization (worldedit-config.yml). |
worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java |
Converts WEPIF config handling from File to Path/Files and constructs YAMLProcessor with a Path. |
Review effort: Balanced
SirYwell
approved these changes
Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Cherry picked EngineHub/WorldEdit#2802.
"Use NIO in the YAMLProcessor class"
THIS SHOULD BE AN EASY APPROVE
This restores compatibility with WorldGuard, which now calls the
Pathconstructors ofYAMLProcessorand fails withNoSuchMethodErroron FAWE.Differences from the upstream commit:
verification/API change list does not exist in FAWE, so that part is dropped.WorldEditPluginapplies.toPath()to FAWE'sworldedit-config.ymlline instead of upstream'sconfig.ymlline.Submitter Checklist
@since TODO. (The newPathconstructors are upstream API and are kept as upstream has them.)