Repository navigation
Commit 2dbd63a
Use PaperLib's asynchronous teleports and chunk loads on 26.x (#6634)
### 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. Every
`PaperLib.teleportAsync`, `getChunkAtAsync` and
`getBedSpawnLocationAsync` call 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
- [x] Most recent Paper version (26.3, git-Paper-140)
- ~~CraftBukkit/Spigot/Paper 1.12.2~~
- ~~CraftBukkit 1.8.8~~
**Demonstration:**
`ModernPaperEnvironmentTest` checks that a 26.x version string leaves
PaperLib's own environment calling `Entity#teleport` and that the new
environment calls `Entity#teleportAsync` and `World#getChunkAtAsync`.
`./gradlew build` passes.
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):
```
PROBE paperlib env=PaperEnvironment version=0 asyncChunksHandler=AsyncChunksSync asyncTeleportHandler=AsyncTeleportSync isGeneratedHandler=ChunkIsGeneratedUnknown bedSpawnLocationHandler=BedSpawnLocationSync
```
After (this PR):
```
PROBE paperlib env=ModernPaperEnvironment version=0 asyncChunksHandler=AsyncChunksPaper_15 asyncTeleportHandler=AsyncTeleportPaper_13 isGeneratedHandler=ChunkIsGeneratedApiExists bedSpawnLocationHandler=BedSpawnLocationPaper
```
The same scripted run of EssentialsX commands (teleports across 12000
blocks, `/tpa`, `/home`, `/spawn`, `/back` after death, a passenger, 22
checks) passes before and after.
Co-authored-by: Raw2d <255907405+Raw2d@users.noreply.github.com>1 parent cfb6f12 commit 2dbd63a
3 files changed
Lines changed: 90 additions & 0 deletions
File tree
- Essentials/src
- main/java/com/earth2me/essentials
- utils
- test/java/com/earth2me/essentials/utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
261 | 262 | | |
262 | 263 | | |
263 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
264 | 269 | | |
265 | 270 | | |
266 | 271 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments