SimpleScore icon indicating copy to clipboard operation
SimpleScore copied to clipboard

Solutions related to “ Encoding packet ‘clientbound/minecraft:set_objective’ failed”

Open wuliao697 opened this issue 1 month ago • 0 comments

Plugin Version

3.12.5

Server Version

paper-1.21.4

Describe the Bug

If the above occurs, the player and is kicked out. I've noticed a problem with package handling when creating a scoreboard. Under com.r4g3baby.simplescore.scoreboard.handlers.ProtocolScoreboard, the createScoreboard method should not be modified with integers in the createScoreboard method, which is byte related.

Maybe it could be modified like this, but I don't know kotlin.

            packet.modifier()
            packet.strings.write(0, getPlayerIdentifier(player)) // Objective Name
            packet.integers.write(0, 0) // Mode 0: Created Scoreboard

Just change it to the above code.I try to tested it.

Relevant Log Output

[12:43:39] [Server thread/INFO]: wuliao697 joined the game
[12:43:39] [Netty Server IO #2/ERROR]: Error sending packet clientbound/minecraft:set_objective
io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:set_objective'
	at net.minecraft.network.codec.IdDispatchCodec.encode(IdDispatchCodec.java:55) ~[paper-1.21.4.jar:1.21.4-117-a35cfe9]
	at net.minecraft.network.codec.IdDispatchCodec.encode(IdDispatchCodec.java:13) ~[paper-1.21.4.jar:1.21.4-117-a35cfe9]
	at net.minecraft.network.PacketEncoder.encode(PacketEncoder.java:27) ~[paper-1.21.4.jar:1.21.4-117-a35cfe9]
	at net.minecraft.network.PacketEncoder.encode(PacketEncoder.java:12) ~[paper-1.21.4.jar:1.21.4-117-a35cfe9]
	at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) ~[netty-codec-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:893) ~[netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:875) ~[netty-transport-4.1.115.Final.jar:4.1.115.Final]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:984)...

wuliao697 avatar Jan 19 '25 05:01 wuliao697