feat: rename PlayerClientLoadedListener to PlayerConnectListener and …#9
Merged
Keviro merged 2 commits intoversion/1.21.11from Feb 8, 2026
Merged
feat: rename PlayerClientLoadedListener to PlayerConnectListener and …#9Keviro merged 2 commits intoversion/1.21.11from
Keviro merged 2 commits intoversion/1.21.11from
Conversation
…add player connection handling
Contributor
There was a problem hiding this comment.
Pull request overview
Renames the Paper listener responsible for handling post-world-load player messaging and adds early connection validation to kick/disallow players whose SurfPlayer data isn’t available.
Changes:
- Renamed
PlayerClientLoadedListenertoPlayerConnectListener. - Added
AsyncPlayerPreLoginEventhandling to disallow logins whenSurfPlayerlookup fails. - Added a shared disconnect component builder used for both kick/disallow paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| surf-core-paper/src/main/kotlin/dev/slne/surf/core/paper/listener/PlayerConnectListener.kt | Renames listener object and adds pre-login disallow + standardized disconnect message. |
| surf-core-paper/src/main/kotlin/dev/slne/surf/core/paper/PaperMain.kt | Updates listener registration to use the new listener name. |
Comments suppressed due to low confidence (4)
surf-core-paper/src/main/kotlin/dev/slne/surf/core/paper/listener/PlayerConnectListener.kt:59
AsyncPlayerPreLoginEventdisallows login based onsurfPlayerService.findPlayerByUuid(...)being present in the cache. On Velocity, the player is cached inConnectionListener.onLoginvia a coroutine (launch { handleConnect(...) }), so the cache update can lag behind the backend connection attempt and cause legitimate players to be kicked intermittently. Consider waiting/loading the player during pre-login (e.g., call a suspending load with a short timeout from this async event), or move this validation to a later stage where the proxy cache is guaranteed to be populated.
surf-core-paper/src/main/kotlin/dev/slne/surf/core/paper/listener/PlayerConnectListener.kt:23- The kick is initiated by the plugin, but the cause is set to
UNKNOWN. Use the most specificPlayerKickEvent.Causeavailable for plugin-driven kicks (typicallyPLUGIN) so logs/analytics and other plugins can correctly interpret the reason.
surf-core-paper/src/main/kotlin/dev/slne/surf/core/paper/listener/PlayerConnectListener.kt:76 - Typo in the disconnect message: in German this should be capitalized as the noun "Laden" ("Beim Laden deiner Daten …").
surf-core-paper/src/main/kotlin/dev/slne/surf/core/paper/listener/PlayerConnectListener.kt:63 buildDisconnectComponent()rebuilds the same immutable component for every kick/disallow. Consider caching it as aprivate valto reduce allocations, especially since it can be executed for every connection attempt.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
…add player connection handling
