fix: improve lock and sync when calling and trimming - #3543
Conversation
dordsor21
commented
May 24, 2026
- also fix error when editing newly generated chunks due to postprocessgen not having been completed
- fixes Plugin "stopping" to work. #3490
PierreSchwang
left a comment
There was a problem hiding this comment.
Untested, but looks reasonable so far
| fieldPendingBlockEntities = ChunkAccess.class.getDeclaredField(Refraction.pickName( | ||
| "pendingBlockEntities", | ||
| "i" | ||
| ) | ||
| ); |
There was a problem hiding this comment.
There shouldn't be any obfuscation anymore, right?
There was a problem hiding this comment.
No idea, I was just going along with everything... If it's been removed we can clean up a bunch of this class I guess? (This field is both paper and spigot fwiw)
- also fix error when editing newly generated chunks due to postprocessgen not having been completed - fixes #3490
a6a08b7 to
45c46ae
Compare
Code reviewFound 2 issues. Both are single-adapter divergences — a change applied correctly to 7 of the 8 per-version copies, missed in the 8th.
Opposite order in The other seven adapters lock in the order that matches their own
Deferred read of the live field: Compare 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
There was a problem hiding this comment.
Pull request overview
This PR focuses on improving concurrency/locking behavior during chunk “call” execution and trimming, and adds handling for editing chunks that are newly generated but have not completed post-processing (pending block entity initialization), addressing issue #3490.
Changes:
- Adjust chunk GET call synchronization/visibility behavior in the shared Bukkit adapter base.
- Add logic across multiple Paperweight adapters to temporarily manage
pendingBlockEntitiesduring edits when post-processing hasn’t completed. - Refactor sync-task construction and trim logic in multiple versioned adapters.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/AbstractBukkitGetBlocks.java | Removes synchronized from call() (relying on callLock) and makes forceLoadSections volatile for cross-thread visibility. |
| worldedit-bukkit/adapters/adapter-26.2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v26_2/PaperweightPlatformAdapter.java | Adds reflective accessors to clear/restore pendingBlockEntities for post-processing handling. |
| worldedit-bukkit/adapters/adapter-26.2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v26_2/PaperweightGetBlocks.java | Uses new post-processing helpers; refactors sync task construction; adjusts trimming flow. |
| worldedit-bukkit/adapters/adapter-26.1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v26_1/PaperweightPlatformAdapter.java | Adds reflective accessors to clear/restore pendingBlockEntities for post-processing handling. |
| worldedit-bukkit/adapters/adapter-26.1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v26_1/PaperweightGetBlocks.java | Uses new post-processing helpers; refactors sync task construction; adjusts trimming flow. |
| worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightPlatformAdapter.java | Adds reflective accessors to clear/restore pendingBlockEntities for post-processing handling. |
| worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightGetBlocks.java | Uses new post-processing helpers; refactors sync task construction and trim logic. |
| worldedit-bukkit/adapters/adapter-1_21_9/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_9/PaperweightPlatformAdapter.java | Adds reflective accessors to clear/restore pendingBlockEntities for post-processing handling. |
| worldedit-bukkit/adapters/adapter-1_21_9/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_9/PaperweightGetBlocks.java | Uses new post-processing helpers; refactors sync task construction; adjusts trimming flow. |
| worldedit-bukkit/adapters/adapter-1_21_6/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_6/PaperweightPlatformAdapter.java | Adds reflective accessors to clear/restore pendingBlockEntities for post-processing handling. |
| worldedit-bukkit/adapters/adapter-1_21_6/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_6/PaperweightGetBlocks.java | Uses new post-processing helpers; refactors sync task construction; adjusts trimming flow. |
| worldedit-bukkit/adapters/adapter-1_21_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_5/PaperweightPlatformAdapter.java | Adds reflective accessors to clear/restore pendingBlockEntities for post-processing handling. |
| worldedit-bukkit/adapters/adapter-1_21_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_5/PaperweightGetBlocks.java | Uses new post-processing helpers; refactors sync task construction; adjusts trimming flow. |
| worldedit-bukkit/adapters/adapter-1_21_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_4/PaperweightPlatformAdapter.java | Adds reflective accessors to clear/restore pendingBlockEntities for post-processing handling. |
| worldedit-bukkit/adapters/adapter-1_21_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_4/PaperweightGetBlocks.java | Uses new post-processing helpers; refactors sync task construction; adjusts trimming flow. |
| worldedit-bukkit/adapters/adapter-1_21_11/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_11/PaperweightPlatformAdapter.java | Adds reflective accessors to clear/restore pendingBlockEntities for post-processing handling. |
| worldedit-bukkit/adapters/adapter-1_21_11/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_11/PaperweightGetBlocks.java | Uses new post-processing helpers; refactors sync task construction; includes corrected trim section-index mapping. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| for (int i = 0; i < trim.length; i++) { | ||
| if (trim[i]) { | ||
| super.trim(false, i); | ||
| } | ||
| } |
| for (int i = 0; i < trim.length; i++) { | ||
| if (trim[i]) { | ||
| super.trim(false, i); | ||
| } | ||
| } |
| for (int i = 0; i < trim.length; i++) { | ||
| if (trim[i]) { | ||
| super.trim(false, i); | ||
| } | ||
| } |
| for (int i = 0; i < trim.length; i++) { | ||
| if (trim[i]) { | ||
| super.trim(false, i); | ||
| } | ||
| } |
| for (int i = 0; i < trim.length; i++) { | ||
| if (trim[i]) { | ||
| super.trim(false, i); | ||
| } | ||
| } |
| } | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| } |
| for (int i = 0; i < trim.length; i++) { | ||
| if (trim[i]) { | ||
| super.trim(false, i); | ||
| } | ||
| } |