✨ feat(block-pdc): enhance persistent data container handling for blocks#343
Merged
Conversation
- implement custom block persistent data container for improved data management - update piston handling to utilize new persistent data structure - add BlockPdcContainerTest for testing block persistent data commands
Contributor
|
This PR contains changes that modified the public API. To update the reference ABI dumps: ./gradlew updateKotlinAbi
git add **/api/**
git commit -m "Update ABI reference"
git pushAfter updating, the CI will pass. Make sure the changes are backward compatible. |
Contributor
There was a problem hiding this comment.
Pull request overview
Enhances Surf API’s Paper block PersistentDataContainer (PDC) tooling and safety, primarily by improving block-PDC move/copy handling and adding a dedicated test command suite in the Paper test plugin.
Changes:
- Added a comprehensive
/surfapitest blockpdctest command for setting/getting/listing/clearing and copying block PDC across regions. - Refactored block PDC persistence/copy internals (including piston move handling) and added tick-thread enforcement when accessing block PDCs.
- Improved Paper test runtime tasks (Folia support, conditional plugin downloads) and bumped Minecraft/version properties.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| surf-api-paper/surf-api-paper/src/main/kotlin/dev/slne/surf/api/paper/util/bukkit-util.kt | Adds utility conversions and async chunk helpers used by test tooling and async world access. |
| surf-api-paper/surf-api-paper-server/src/main/kotlin/dev/slne/surf/api/paper/server/impl/pdc/block/CustomBlockData.kt | Refines CustomBlockData internals (weak chunk ref, key helpers) and changes copy semantics. |
| surf-api-paper/surf-api-paper-server/src/main/kotlin/dev/slne/surf/api/paper/server/impl/pdc/block/BlockPdcProviderImpl.kt | Enforces tick-thread access when retrieving a block PDC. |
| surf-api-paper/surf-api-paper-server/src/main/kotlin/dev/slne/surf/api/paper/server/impl/pdc/block/BlockDataListener.kt | Refactors piston PDC move handling to use CustomBlockPersistentDataContainer directly. |
| surf-api-paper/surf-api-paper-plugin-test/src/main/kotlin/dev/slne/surf/surfapi/bukkit/test/command/subcommands/BlockPdcContainerTest.kt | New test subcommand implementing set/get/list/clear and near/far copy validation. |
| surf-api-paper/surf-api-paper-plugin-test/src/main/java/dev/slne/surf/api/paper/test/command/SurfApiTestCommand.java | Registers the new blockpdc subcommand under the test command root. |
| surf-api-paper/surf-api-paper-plugin-test/build.gradle.kts | Updates run tasks to support Folia and conditional plugin downloads for local testing. |
| gradle.properties | Bumps mcVersion and project version. |
…lock - clear the persistent data container of the block before copying data from pdc - ensure no residual data remains in the block's pdc after the copy operation
Contributor
|
This PR contains changes that modified the public API. To update the reference ABI dumps: ./gradlew updateKotlinAbi
git add **/api/**
git commit -m "Update ABI reference"
git pushAfter updating, the CI will pass. Make sure the changes are backward compatible. |
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.
This pull request introduces several improvements and new features related to block persistent data containers (PDC) in the Surf API for Paper, enhances test plugin capabilities, and includes various utility and maintenance updates. The most significant changes are the addition of a comprehensive test command for block PDC operations, refactoring and optimization of PDC handling, and improved configuration for test environments.
Block Persistent Data Container (PDC) Improvements
BlockPdcContainerTestcommand, providing a suite of subcommands (set,get,list,clear,copy-near,copy-far) for testing block-level PDC operations, including advanced copy tests across regions. ([[1]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-6eca36e8879fd97e968cdaf866674f54512159e4417e9611a69a121fef4a2e13R1-R228),[[2]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-55d4e84be3738641b06fcd462c85e60b18dbbfc2c25ed5658d6fc7a9d990e98eL33-R34))CustomBlockPersistentDataContainerdirectly, optimizing copy and clear operations and improving type safety. ([[1]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-c1342adc8a4d6812c2defe7fe1db698801a091094cd750e855fd284cdd0d7c02R25-L27),[[2]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-c1342adc8a4d6812c2defe7fe1db698801a091094cd750e855fd284cdd0d7c02L38-L39),[[3]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-c1342adc8a4d6812c2defe7fe1db698801a091094cd750e855fd284cdd0d7c02L167-R185))[surf-api-paper/surf-api-paper-server/src/main/kotlin/dev/slne/surf/api/paper/server/impl/pdc/block/BlockPdcProviderImpl.ktR6-R12](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-63c0fd1d516396e4883ece70e58acbf5741dd18c95ee8766c2476c3afa68b8d9R6-R12))CustomBlockDataby using a weak reference for chunk storage, enhancing memory management, and refactored key generation for better reusability. ([[1]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-2c137158554c90de41417c6ff66790116a254111c96450ce45745e7a150f89b6R34-R39),[[2]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-2c137158554c90de41417c6ff66790116a254111c96450ce45745e7a150f89b6L62-R67),[[3]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-2c137158554c90de41417c6ff66790116a254111c96450ce45745e7a150f89b6L135-R144))Test Plugin and Build System Enhancements
xyz.jpenilla.runpaper.task.RunServerand improvedrunServer/runPapertask configuration to support Folia and conditional plugin downloads, enhancing test automation and compatibility. ([[1]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-2c2926e89c5b22702585aa2b98aec2db9fbeff33cb0d2c944949b5f8b9301113R2),[[2]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-2c2926e89c5b22702585aa2b98aec2db9fbeff33cb0d2c944949b5f8b9301113R28),[[3]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-2c2926e89c5b22702585aa2b98aec2db9fbeff33cb0d2c944949b5f8b9301113L43-R45),[[4]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-2c2926e89c5b22702585aa2b98aec2db9fbeff33cb0d2c944949b5f8b9301113R54-R74))26.1.2ingradle.properties. ([gradle.propertiesL8-R8](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-3d103fc7c312a3e136f88e81cef592424b8af2464c468116545c4d22d6edcf19L8-R8))Utility and Documentation Improvements
[[1]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-28001ce9fe8aa3617c00b9e01bb8eebf891191e395cf19df72abb15f66fb6ff2R31),[[2]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-28001ce9fe8aa3617c00b9e01bb8eebf891191e395cf19df72abb15f66fb6ff2R143-R148),[[3]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-28001ce9fe8aa3617c00b9e01bb8eebf891191e395cf19df72abb15f66fb6ff2R165-R170),[[4]](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-28001ce9fe8aa3617c00b9e01bb8eebf891191e395cf19df72abb15f66fb6ff2R181-R186))Minor Code Cleanups
dev.jorel.commandapi.*for improved code clarity. ([surf-api-paper/surf-api-paper-plugin-test/src/main/java/dev/slne/surf/api/paper/test/command/SurfApiTestCommand.javaL3-R3](https://github.com/SLNE-Development/surf-api/pull/343/files#diff-55d4e84be3738641b06fcd462c85e60b18dbbfc2c25ed5658d6fc7a9d990e98eL3-R3))These changes collectively improve the reliability, testability, and maintainability of block PDC features in the Surf API.