Describe the bug
I think there is a Fabric regression in the pre-Via/post-Via state split introduced in c44d85c.
On Fabric, when a bundled PE user enables preViaInjection(true), PacketEvents runs a pre-Via packet pass even when ViaVersion is not installed. That pre-Via pass is dispatched only to listeners where isPreVia() == true.
Bukkit registers a second internal pre-Via listener in c44d85c, but Fabric still appears to register only the normal InternalFabricPacketListener. Because of that, the pre-Via connection state can stay behind during login/configuration. A later configuration-phase packet can then be mapped using the stale LOGIN state, and the connection is closed before the player finishes joining.
This seems to affect:
- Bad:
c44d85c10021bd669b63bf529b64d515bd7ad2e8
- Still bad:
0759fbb4600a3b8eb314fa9027cedc7defbcc14d
- Last known good in my tests:
22c9961f3aa5e6071c47a0d846cdaeda944af723
0759fbb adjusts decoder state transitions, but it does not seem to add a Fabric pre-Via internal listener or skip the synthetic pre-Via pass when ViaVersion is absent.
Software brand
Fabric 1.21.11
Plugins
Minimal reproduction:
- Fabric API
- GrimAC Fabric build bundling PacketEvents
No ViaVersion, ViaFabric, ViaBackwards, or other server mods were required to reproduce it.
How To Reproduce
- Start a clean Fabric 1.21.11 server.
- Install Fabric API.
- Install a GrimAC Fabric build that bundles PE
2.12.2+c44d85c-SNAPSHOT or 2.12.2+0759fbb-SNAPSHOT.
- Join the server.
- The player disconnects before the backend logs a successful join.
In the same environment:
- Fabric API only: login succeeds.
- Grim build with PE
2.12.2+22c9961-SNAPSHOT: login succeeds.
- Grim build with PE
2.12.2+c44d85c-SNAPSHOT: login fails.
- Grim build with PE
2.12.2+0759fbb-SNAPSHOT: login fails.
Expected behavior
Fabric should either:
- Register an internal pre-Via Fabric listener, equivalent to the Bukkit pre-Via listener added in
c44d85c, so pre-Via state transitions are maintained, or
- Avoid running the synthetic pre-Via pass on Fabric when ViaVersion is not actually available.
Screenshots
N/A
Additional context
The relevant change looks like c44d85c added separate preViaEncoderState / preViaDecoderState and changed event creation to choose pre-Via or post-Via state based on autoProtocolTranslation.
Fabric PacketDecoder still has this path:
if (!preViaVersion && PacketEvents.getAPI().getSettings().isPreViaInjection() && !ViaVersionUtil.isAvailable(user)) {
PacketEventsImplHelper.handleServerBoundPacket(ctx.channel(), user, player, msg, false);
}
But Fabric API load still appears to register only:
this.getEventManager().registerListener(new InternalFabricPacketListener());
So the synthetic pre-Via pass runs, but the internal state listener for that pass is missing.
Describe the bug
I think there is a Fabric regression in the pre-Via/post-Via state split introduced in
c44d85c.On Fabric, when a bundled PE user enables
preViaInjection(true), PacketEvents runs a pre-Via packet pass even when ViaVersion is not installed. That pre-Via pass is dispatched only to listeners whereisPreVia() == true.Bukkit registers a second internal pre-Via listener in
c44d85c, but Fabric still appears to register only the normalInternalFabricPacketListener. Because of that, the pre-Via connection state can stay behind during login/configuration. A later configuration-phase packet can then be mapped using the staleLOGINstate, and the connection is closed before the player finishes joining.This seems to affect:
c44d85c10021bd669b63bf529b64d515bd7ad2e80759fbb4600a3b8eb314fa9027cedc7defbcc14d22c9961f3aa5e6071c47a0d846cdaeda944af7230759fbbadjusts decoder state transitions, but it does not seem to add a Fabric pre-Via internal listener or skip the synthetic pre-Via pass when ViaVersion is absent.Software brand
Fabric 1.21.11
Plugins
Minimal reproduction:
No ViaVersion, ViaFabric, ViaBackwards, or other server mods were required to reproduce it.
How To Reproduce
2.12.2+c44d85c-SNAPSHOTor2.12.2+0759fbb-SNAPSHOT.In the same environment:
2.12.2+22c9961-SNAPSHOT: login succeeds.2.12.2+c44d85c-SNAPSHOT: login fails.2.12.2+0759fbb-SNAPSHOT: login fails.Expected behavior
Fabric should either:
c44d85c, so pre-Via state transitions are maintained, orScreenshots
N/A
Additional context
The relevant change looks like
c44d85cadded separatepreViaEncoderState/preViaDecoderStateand changed event creation to choose pre-Via or post-Via state based onautoProtocolTranslation.Fabric
PacketDecoderstill has this path:But Fabric API load still appears to register only:
So the synthetic pre-Via pass runs, but the internal state listener for that pass is missing.