From 8d9b89fe03ef18a0689cb9a594bcf6f24ec71776 Mon Sep 17 00:00:00 2001 From: Bafy78 <30290088+Bafy78@users.noreply.github.com> Date: Mon, 21 Sep 2026 20:34:55 +0200 Subject: [PATCH] Fix #20: end the Fabric networking session when a dummy leaves Fabric only untracks a listener's network addon from Connection.channelInactive or handleDisconnection, which a channel-less dummy never reaches, so leave() now calls handleDisconnect() itself before onDisconnect. Co-Authored-By: Claude Fable 5.1 --- src/main/java/io/github/misode/packtest/dummy/Dummy.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/io/github/misode/packtest/dummy/Dummy.java b/src/main/java/io/github/misode/packtest/dummy/Dummy.java index 3fe8b03..ab5c610 100644 --- a/src/main/java/io/github/misode/packtest/dummy/Dummy.java +++ b/src/main/java/io/github/misode/packtest/dummy/Dummy.java @@ -1,6 +1,7 @@ package io.github.misode.packtest.dummy; import com.mojang.authlib.GameProfile; +import net.fabricmc.fabric.impl.networking.PacketListenerExtensions; import net.minecraft.core.BlockPos; import net.minecraft.network.DisconnectionDetails; import net.minecraft.network.chat.Component; @@ -80,6 +81,11 @@ public String getUsername() { @SuppressWarnings("resource") public void leave(Component reason) { Objects.requireNonNull(this.level().getServer()).getPlayerList().remove(this); + // Fabric only ends its networking session from Connection.channelInactive/handleDisconnection, + // which a channel-less dummy never reaches; without this the listener stays tracked forever. + if (this.connection instanceof PacketListenerExtensions extensions) { + extensions.getAddon().handleDisconnect(); + } this.connection.onDisconnect(new DisconnectionDetails(reason)); }