Sponge icon indicating copy to clipboard operation
Sponge copied to clipboard

Attempting to send custom clientbound packet errors & kicks player

Open qixils opened this issue 1 year ago • 0 comments

Affected Product(s)

SpongeForge

Version

1.20.6-50.0.22-11.0.1-RC1778

Operating System

Windows

Java Version

21.0.4/64-bit (Eclipse Adoptium)

Plugins/Mods

Just SpongeForge and my mod :-)

Describe the bug

Attempting to send a custom packet to a player results in an exception being thrown and the player disconnected, on SpongeForge. I did briefly test on SpongeVanilla and did not see any exceptions, (although I can't 100% confirm if I was actually receiving those packets, will update tomorrow as I test more). Repro code looks something like:

public class PluginChannel {
	private RawDataChannel channel;

	@Listener
	public void onRegisterChannels(RegisterChannelEvent event) {
		channel = event.register(ResourceKey.resolve("crowdcontrol:version-request", RawDataChannel.class);
	}

	public void sendMessage(ServerPlayer player, PluginPacket packet) {
		channel.play().sendTo(player, buf -> buf.writeString("hello world"));
	}
}

Stacktrace is attached below. Not super familiar with Sponge's internal structure; I do see ClientboundCustomPayloadPacketMixin_Vanilla appears to register the SpongeChannelPayload, but it only seems to exist in the Vanilla package and not the Forge package? Could explain why the error occurs only on SF but I'm not sure :P

Link to logs

https://gist.github.com/qixils/b36964dd3d7ba8a20705ecf8f68f6477

qixils avatar Aug 01 '24 02:08 qixils