Skip to content

Commit f3e7f43

Browse files
authored
fix: correct Play ClientBound plugin.Message packet ID for 1.21.9+ (fixes minekube#612) (minekube#674)
The plugin.Message packet was incorrectly mapped to 0x1C for Minecraft 1.21.9 instead of staying at 0x18 (same as 1.21.5). This caused the proxy to not recognize BungeeCord plugin channel messages from backend servers, silently breaking server transfers via the "Connect" subchannel.
1 parent 3db7f7b commit f3e7f43

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

pkg/edition/java/proto/state/register.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,6 @@ func init() {
523523
m(0x18, version.Minecraft_1_20_2),
524524
m(0x19, version.Minecraft_1_20_5),
525525
m(0x18, version.Minecraft_1_21_5),
526-
m(0x1C, version.Minecraft_1_21_9),
527526
)
528527
Play.ClientBound.Register(&p.RemoveResourcePack{},
529528
m(0x43, version.Minecraft_1_20_3),
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package state
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/require"
7+
"go.minekube.com/gate/pkg/edition/java/proto/packet/plugin"
8+
"go.minekube.com/gate/pkg/edition/java/proto/version"
9+
proto "go.minekube.com/gate/pkg/gate/proto"
10+
)
11+
12+
// TestPluginMessagePacketID_1_21_9 verifies that the Play ClientBound plugin.Message
13+
// packet ID is correct for Minecraft 1.21.9 (protocol 773).
14+
// This was incorrectly mapped to 0x1C instead of 0x18, causing BungeeCord
15+
// plugin channel messages to be silently dropped (fixes #612).
16+
func TestPluginMessagePacketID_1_21_9(t *testing.T) {
17+
tests := []struct {
18+
name string
19+
protocol proto.Protocol
20+
wantID int
21+
}{
22+
{"1.21.5 should be 0x18", version.Minecraft_1_21_5.Protocol, 0x18},
23+
{"1.21.7 should be 0x18", version.Minecraft_1_21_7.Protocol, 0x18},
24+
{"1.21.9 should be 0x18", version.Minecraft_1_21_9.Protocol, 0x18},
25+
{"1.21.11 should be 0x18", version.Minecraft_1_21_11.Protocol, 0x18},
26+
}
27+
for _, tc := range tests {
28+
t.Run(tc.name, func(t *testing.T) {
29+
reg := Play.ClientBound.ProtocolRegistry(tc.protocol)
30+
require.NotNil(t, reg, "no protocol registry for protocol %d", tc.protocol)
31+
id, ok := reg.PacketID(&plugin.Message{})
32+
require.True(t, ok, "plugin.Message not registered for protocol %d", tc.protocol)
33+
require.Equal(t, proto.PacketID(tc.wantID), id,
34+
"plugin.Message packet ID mismatch for protocol %d", tc.protocol)
35+
})
36+
}
37+
}

0 commit comments

Comments
 (0)