Skip to content

fix: PreviousServer is always nil#541

Merged
robinbraemer merged 2 commits into
masterfrom
fix/issue-539
Jun 13, 2025
Merged

fix: PreviousServer is always nil#541
robinbraemer merged 2 commits into
masterfrom
fix/issue-539

Conversation

@robinbraemer

Copy link
Copy Markdown
Member

fixes #539
closes #540

  • Added a previousServer field to ServerPreConnectEvent and serverConnection to track the server a player was previously connected to.
  • Updated constructors and methods to accommodate the new previousServer parameter, improving connection request handling and event firing.
  • Enhanced createConnectionRequest to include the previous connection for better context during server transitions.

fixes #539
closes #540

- Added a `previousServer` field to `ServerPreConnectEvent` and `serverConnection` to track the server a player was previously connected to.
- Updated constructors and methods to accommodate the new `previousServer` parameter, improving connection request handling and event firing.
- Enhanced `createConnectionRequest` to include the previous connection for better context during server transitions.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 12, 2025

Copy link
Copy Markdown

Deploying gate-minekube with  Cloudflare Pages  Cloudflare Pages

Latest commit: e626bf1
Status: ✅  Deploy successful!
Preview URL: https://736c15bd.gate-minekube.pages.dev
Branch Preview URL: https://fix-issue-539.gate-minekube.pages.dev

View logs

@robinbraemer robinbraemer requested a review from Copilot June 12, 2025 09:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue where the previous server was not properly tracked during player connections by adding a new previousServer field and updating the connection request and event firing functions.

  • Added a new field previousServer to both ServerPreConnectEvent and serverConnection.
  • Introduced createConnectionRequestWith to pass along the previous connection data.
  • Updated related functions and events (handleKickEvent, session backend transition, newServerConnection, and newServerPreConnectEvent) to use the new parameter.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
pkg/edition/java/proxy/switch.go Updated connection request and event initialization to include previousServer.
pkg/edition/java/proxy/session_backend_transition.go Adjusted previous server tracking during session backend transitions.
pkg/edition/java/proxy/server.go Modified newServerConnection to accept a previousServer parameter.
pkg/edition/java/proxy/events.go Revised ServerPreConnectEvent constructor to include previousServer and added a getter.

Comment thread pkg/edition/java/proxy/session_backend_transition.go
- Updated the handling of the previousServer field in ServerConnectedEvent and ServerPostConnectEvent to ensure it is only assigned when non-nil, preventing incorrect nil pointer storage.
- This change enhances the integrity of event data during server transitions, ensuring accurate tracking of previous connections.
@robinbraemer robinbraemer merged commit 322916a into master Jun 13, 2025
7 checks passed
@robinbraemer robinbraemer deleted the fix/issue-539 branch June 13, 2025 14:17
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.

bug: PreviousServer is always nil

2 participants