refactor: Add HuskSync support for player statistics retrieval and update async #172
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.
Honestly, this PR includes some breaking changes.
I found the
RequestProcessorclass in the source code and thought you might have anticipated the potential need for adapting to other data sources in the future. So, I went ahead and refactoredStatResult.To accommodate potential asynchronous results, I wrapped
StatResult<?>with aCompletableFuture. This will make plugins that depend onPlayerStatsincompatible (maybe a deprecation warning would be appropriate).HuskSyncis a 'modern, cross-server player data synchronization system...' and it's currently really useful on the proxy server. It works well on my server. When I installedPlayerStatson the lobby server, stats generated on the survival server weren't syncing to Bukkit in real-time through this plugin. The plugin has an internal communication mechanism that almost instantly broadcasts stats from one server to others.In this PR, I created a new processor to pull real-time data from
HuskSync.(I’m not a native English speaker, so the above translation might contain errors. Thanks for understanding!)