Skip to content

fix: correct PluginMessageEvent source/target in initial connect handler#693

Merged
robinbraemer merged 1 commit into
masterfrom
fix/plugin-message-event-source-target
Jun 2, 2026
Merged

fix: correct PluginMessageEvent source/target in initial connect handler#693
robinbraemer merged 1 commit into
masterfrom
fix/plugin-message-event-source-target

Conversation

@robinbraemer

Copy link
Copy Markdown
Member

Summary

In initialConnectSessionHandler.handlePluginMessage, plugin messages received from the client during the initial server connect were fired with the PluginMessageEvent source and target swapped:

source:     serverConn,        // wrong: this is the destination
target:     serverConn.player, // wrong: this is the origin

The message actually flows client → server (it is forwarded to the backend via serverMc.WritePacket), so the source must be the player and the target the server connection — exactly as the play-phase handler (session_client_play.go) already does it.

source:     i.player,
target:     serverConn,

This means plugin listeners observing PluginMessageEvent during the initial connect phase now see correct Source()/Target() values, consistent with every other phase.

Upstream

Ports PaperMC/Velocity#1811 ("Fix inverted PluginMessageEvent source/target in InitialConnectSessionHandler").

Testing

  • go build ./pkg/edition/java/proxy/ — ok
  • go vet ./pkg/edition/java/proxy/ — clean
  • go test ./pkg/edition/java/proxy/ — pass

During the initial server connect, plugin messages received from the
client were fired with the source and target swapped (source=server,
target=player). The message actually flows client->server and is
forwarded to the backend, so the source must be the player and the
target the server connection, matching the play-phase handler.

Ports PaperMC/Velocity#1811.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying gate-minekube with  Cloudflare Pages  Cloudflare Pages

Latest commit: 830b1f1
Status: ✅  Deploy successful!
Preview URL: https://447091c0.gate-minekube.pages.dev
Branch Preview URL: https://fix-plugin-message-event-sou.gate-minekube.pages.dev

View logs

@robinbraemer robinbraemer merged commit a634425 into master Jun 2, 2026
13 checks passed
@robinbraemer robinbraemer deleted the fix/plugin-message-event-source-target branch June 2, 2026 10:51
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