Use PaperLib's asynchronous teleports and chunk loads on 26.x - #6634
Open
lewisgibson wants to merge 1 commit into
Open
lewisgibson wants to merge 1 commit into
lewisgibson wants to merge 1 commit into
Conversation
PaperLib 1.0.6 reads the server version with a regex that only accepts a single digit major version, so on 26.x it sees version 0 and falls back to its synchronous handlers. Every PaperLib.teleportAsync, getChunkAtAsync and getBedSpawnLocationAsync call in EssentialsX then ran a blocking teleport or chunk load instead of the asynchronous Paper API. When PaperLib cannot read the version of a server that is newer than 1.13, install an environment that selects the handlers PaperLib would have chosen for a modern Paper. Co-authored-by: Raw2d <255907405+Raw2d@users.noreply.github.com>
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.
Information
This PR fixes #6632.
Details
Proposed fix:
PaperLib 1.0.6 reads the server version from
Bukkit#getVersion()with a regex that only accepts a single digit major version, so on 26.x it reads the version as 0 and selects its synchronous fallbacks. EveryPaperLib.teleportAsync,getChunkAtAsyncandgetBedSpawnLocationAsynccall in EssentialsX then loads the chunk and teleports on the calling thread instead of using Paper's asynchronous API.When PaperLib has not recognised a Paper server that is newer than 1.13, EssentialsX now installs a PaperLib environment which selects the handlers PaperLib would have chosen for 1.15.2 and later. Nothing changes on servers where PaperLib reads the version correctly.
Environments tested:
OS: Ubuntu 24.04 (WSL2)
Java version: Temurin 25.0.4.1
CraftBukkit/Spigot/Paper 1.12.2CraftBukkit 1.8.8Demonstration:
ModernPaperEnvironmentTestchecks that a 26.x version string leaves PaperLib's own environment callingEntity#teleportand that the new environment callsEntity#teleportAsyncandWorld#getChunkAtAsync../gradlew buildpasses.Handlers PaperLib selected on Paper 26.3 (build 140), read from the bundled PaperLib by a test plugin:
Before (2.x, Paper 26.3 build 140):
After (this PR):
The same scripted run of EssentialsX commands (teleports across 12000 blocks,
/tpa,/home,/spawn,/backafter death, a passenger, 22 checks) passes before and after.