Skip to content

feat: rename PlayerClientLoadedListener to PlayerConnectListener and …#9

Merged
Keviro merged 2 commits intoversion/1.21.11from
feat/kick-failed-players
Feb 8, 2026
Merged

feat: rename PlayerClientLoadedListener to PlayerConnectListener and …#9
Keviro merged 2 commits intoversion/1.21.11from
feat/kick-failed-players

Conversation

@TheBjoRedCraft
Copy link
Copy Markdown
Member

@TheBjoRedCraft TheBjoRedCraft commented Feb 8, 2026

…add player connection handling
image

@TheBjoRedCraft TheBjoRedCraft self-assigned this Feb 8, 2026
Copilot AI review requested due to automatic review settings February 8, 2026 00:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 PlayerClientLoadedListener to PlayerConnectListener.
  • Added AsyncPlayerPreLoginEvent handling to disallow logins when SurfPlayer lookup 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

  • AsyncPlayerPreLoginEvent disallows login based on surfPlayerService.findPlayerByUuid(...) being present in the cache. On Velocity, the player is cached in ConnectionListener.onLogin via 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 specific PlayerKickEvent.Cause available for plugin-driven kicks (typically PLUGIN) 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 a private val to 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.

@Keviro Keviro merged commit 0d9a85e into version/1.21.11 Feb 8, 2026
@Keviro Keviro deleted the feat/kick-failed-players branch February 8, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants