fix(paper): prevent players from being incorrectly teleported to world spawn on login - #66
Closed
naipret wants to merge 2 commits into
Closed
fix(paper): prevent players from being incorrectly teleported to world spawn on login#66naipret wants to merge 2 commits into
naipret wants to merge 2 commits into
Conversation
Previously, `spawnLocationCache` and `joinedWhileDead` caches expired after only 2 minutes. This caused a bug where players who took longer than 2 minutes to authenticate (e.g., typing `/login`) would lose their saved coordinates and get forcefully teleported to the world's default spawn. Increasing the expiration time to 1 hour gives players ample time to log in without losing their location.
The `AsyncPlayerSpawnLocationEvent` was previously unconditionally overwriting the player's spawn location with the world's default spawn. This caused players with active sessions (auto-login) to permanently lose their exact logout coordinates upon joining. Now, if a player is authorized via an active session and connects to the same world, their original `eventSpawnLocation` coordinates are explicitly preserved.
Owner
|
Hi! Sorry for the lack of response. I must have missed a notification or something. The issue should be fixed in Vuxeim's PR #69 |
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.
Description
This PR fixes a critical and highly disruptive bug on Paper where players are frequently teleported to the world's default spawn
(0, y, 0)upon joining, instead of spawning at their actual logout coordinates.Motivation and Context
Many server owners and players experienced an issue where their survival coordinates were permanently lost upon logging in. After investigating the Paper module, I identified two root causes for this behavior, which this PR addresses:
Session/Auto-login Bug: In
chooseWorld(PaperListeners.java), the event spawn location was being unconditionally overwritten byworld.value().getSpawnLocation(). When a player has an active session, they bypass the/loginphase and its subsequent teleportation logic. Consequently, their logout coordinates were forcibly overwritten by the world's default spawn upon joining.world.key()) and staying in the same world. If true, theireventSpawnLocationis preserved.Cache Expiration Bug: The
spawnLocationCachewas set to expire after exactly 2 minutes. If an unauthorized player took slightly longer than 2 minutes to type/login <password>, the cache would returnnull, causing the fallback logic to teleport them to the world spawn instead of their original location.How Has This Been Tested?
/logincorrectly restores coordinates after 5+ minutes).Types of changes