Skip to content

Add disconnect identity check debug logs & get CorePlayer directly#66

Merged
EarthCow merged 2 commits into
devfrom
improvement/proxy-disconnect-identity-logs
May 30, 2026
Merged

Add disconnect identity check debug logs & get CorePlayer directly#66
EarthCow merged 2 commits into
devfrom
improvement/proxy-disconnect-identity-logs

Conversation

@EarthCow
Copy link
Copy Markdown
Contributor

Get the CorePlayer directly from the PlayerManager instead of using getOrPutPlayer in the DisconnectEvent. This prevents pointlessly instantiating a new CorePlayer object.

Debug log when a DisconnectEvent is ignored due to a null or duplicate CorePlayer.

@EarthCow EarthCow changed the base branch from master to dev May 30, 2026 17:02
@EarthCow
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8298af6b-8ad0-4266-8cf6-0650a2dcbf9b

📥 Commits

Reviewing files that changed from the base of the PR and between 518df4d and 8551395.

📒 Files selected for processing (4)
  • src/main/java/xyz/earthcow/networkjoinmessages/bungee/BungeeMain.java
  • src/main/java/xyz/earthcow/networkjoinmessages/bungee/listeners/PlayerListener.java
  • src/main/java/xyz/earthcow/networkjoinmessages/velocity/VelocityMain.java
  • src/main/java/xyz/earthcow/networkjoinmessages/velocity/listeners/PlayerListener.java

📝 Walkthrough

Improvements

  • Changed disconnect event handling to retrieve CorePlayer directly from PlayerManager instead of calling getOrPutPlayer, avoiding unnecessary creation of new CorePlayer objects
  • Added null-handling guard for disconnect events when CorePlayer is not found in the player manager
  • Enhanced disconnect event identity validation with debug logging to track when events are ignored due to null CorePlayer or duplicate identity mismatches

Development

  • Updated PlayerListener constructor signatures in both Bungee and Velocity implementations to accept logger parameters (BungeeLogger and VelocityLogger respectively)
  • Modified BungeeMain and VelocityMain to pass logger instances when registering PlayerListener
  • Refactored disconnect event handling to include explicit identity-check logging that documents null or duplicate session scenarios

Walkthrough

Both Bungee and Velocity PlayerListener classes now receive a logger via constructor injection. Disconnect event handling adds explicit null-checks and debug logging before processing, replacing the previous unconditional player-creation path with a safer look-up-and-validate pattern.

Changes

Player Disconnect Logging

Layer / File(s) Summary
Bungee player disconnect logging
src/main/java/xyz/earthcow/networkjoinmessages/bungee/BungeeMain.java, src/main/java/xyz/earthcow/networkjoinmessages/bungee/listeners/PlayerListener.java
BungeeMain registers PlayerListener with BungeeLogger. PlayerListener constructor stores the logger and uses it during disconnect to debug-log ignored events when CorePlayer is null or identity mismatches, before returning early.
Velocity player disconnect logging
src/main/java/xyz/earthcow/networkjoinmessages/velocity/VelocityMain.java, src/main/java/xyz/earthcow/networkjoinmessages/velocity/listeners/PlayerListener.java
VelocityMain registers PlayerListener with VelocityLogger. PlayerListener constructor stores the logger and uses it during disconnect to debug-log ignored events when CorePlayer is null or identity mismatches, before returning early.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A logger joins the listener's call,
Two platforms now see disconnect's fall,
No silent drops when players leave—
Debug messages weave and grieve. 📝✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the two main changes: adding debug logs for disconnect identity checks and refactoring to get CorePlayer directly from PlayerManager instead of creating new instances.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improvement/proxy-disconnect-identity-logs

Comment @coderabbitai help to get the list of available commands and usage tips.

@EarthCow EarthCow merged commit 172cde1 into dev May 30, 2026
2 checks passed
@EarthCow EarthCow deleted the improvement/proxy-disconnect-identity-logs branch May 30, 2026 21:54
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.

1 participant