retrooper / packetevents

Precision meets performance—a powerful tool for mastering Minecraft packet manipulation with speed and finesse.
GNU General Public License v3.0
539 stars 152 forks source link

[Bug] Expected NBTByte but got NBTInt #1008

Closed mizpablito closed 1 month ago

mizpablito commented 1 month ago

Describe the bug When a player (non premium) connects to the server and is transferred to the NanoLimbo server for authorization, the following error appears in the proxy server console (velocity):

[17:24:57 WARN] [com.github.retrooper.packetevents.PacketEventsAPI]: PacketEvents caught an unhandled exception while calling your listener.
java.lang.IllegalArgumentException: Expected NBTByte but got NBTInt
        at com.github.retrooper.packetevents.util.adventure.AdventureNBTSerializer.requireType(AdventureNBTSerializer.java:759) ~[?:?]
        at com.github.retrooper.packetevents.util.adventure.AdventureNBTSerializer.access$200(AdventureNBTSerializer.java:75) ~[?:?]
        at com.github.retrooper.packetevents.util.adventure.AdventureNBTSerializer$NBTReader.lambda$useBoolean$0(AdventureNBTSerializer.java:566) ~[?:?]
        at com.github.retrooper.packetevents.util.adventure.AdventureNBTSerializer$NBTReader.useTag(AdventureNBTSerializer.java:676) ~[?:?]
        at com.github.retrooper.packetevents.util.adventure.AdventureNBTSerializer$NBTReader.useBoolean(AdventureNBTSerializer.java:566) ~[?:?]
        at com.github.retrooper.packetevents.util.adventure.AdventureNBTSerializer.deserializeStyle(AdventureNBTSerializer.java:333) ~[?:?]
        at com.github.retrooper.packetevents.protocol.chat.ChatTypeDecoration.decode(ChatTypeDecoration.java:93) ~[?:?]
        at com.github.retrooper.packetevents.protocol.chat.ChatType.decode(ChatType.java:97) ~[?:?]
        at com.github.retrooper.packetevents.util.mappings.SynchronizedRegistriesHandler$RegistryEntry.handleElement(SynchronizedRegistriesHandler.java:188) ~[?:?]
        at com.github.retrooper.packetevents.util.mappings.SynchronizedRegistriesHandler$RegistryEntry.createFromElements(SynchronizedRegistriesHandler.java:224) ~[?:?]
        at com.github.retrooper.packetevents.util.mappings.SynchronizedRegistriesHandler.lambda$handleRegistry$0(SynchronizedRegistriesHandler.java:113) ~[?:?]
        at com.github.retrooper.packetevents.util.mappings.SynchronizedRegistriesHandler$RegistryEntry.lambda$computeSyncedRegistry$0(SynchronizedRegistriesHandler.java:171) ~[?:?]
        at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1740) ~[?:?]
        at com.github.retrooper.packetevents.util.mappings.SynchronizedRegistriesHandler$RegistryEntry.computeSyncedRegistry(SynchronizedRegistriesHandler.java:170) ~[?:?]
        at com.github.retrooper.packetevents.util.mappings.SynchronizedRegistriesHandler.handleRegistry(SynchronizedRegistriesHandler.java:112) ~[?:?]
        at com.github.retrooper.packetevents.util.mappings.SynchronizedRegistriesHandler.handleLegacyRegistries(SynchronizedRegistriesHandler.java:131) ~[?:?]
        at com.github.retrooper.packetevents.manager.InternalPacketListener.onPacketSend(InternalPacketListener.java:94) ~[?:?]
        at com.github.retrooper.packetevents.event.PacketSendEvent.call(PacketSendEvent.java:51) ~[?:?]
        at com.github.retrooper.packetevents.event.EventManager.callEvent(EventManager.java:84) ~[?:?]
        at io.github.retrooper.packetevents.handlers.PacketEventsEncoder.read(PacketEventsEncoder.java:46) ~[?:?]
        at io.github.retrooper.packetevents.handlers.PacketEventsEncoder.encode(PacketEventsEncoder.java:70) ~[?:?]
        at io.github.retrooper.packetevents.handlers.PacketEventsEncoder.encode(PacketEventsEncoder.java:32) ~[?:?]
        at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:893) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:875) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:984) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:868) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:113) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:893) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:875) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:984) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:868) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at com.velocitypowered.proxy.protocol.netty.PlayPacketQueueOutboundHandler.write(PlayPacketQueueOutboundHandler.java:67) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:891) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:956) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:982) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:950) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1020) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:311) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at com.velocitypowered.proxy.connection.MinecraftConnection.write(MinecraftConnection.java:234) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at com.velocitypowered.proxy.connection.backend.ConfigSessionHandler.handle(ConfigSessionHandler.java:271) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at com.velocitypowered.proxy.protocol.packet.config.RegistrySyncPacket.handle(RegistrySyncPacket.java:48) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at com.velocitypowered.proxy.connection.MinecraftConnection.channelRead(MinecraftConnection.java:153) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at com.velocitypowered.proxy.protocol.netty.AutoReadHolderHandler.channelRead(AutoReadHolderHandler.java:57) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at com.velocitypowered.proxy.protocol.netty.PlayPacketQueueInboundHandler.channelRead(PlayPacketQueueInboundHandler.java:62) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at com.velocitypowered.proxy.protocol.netty.MinecraftDecoder.tryDecode(MinecraftDecoder.java:91) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at com.velocitypowered.proxy.protocol.netty.MinecraftDecoder.channelRead(MinecraftDecoder.java:60) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:333) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:454) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:509) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[velocity.jar:3.3.0-SNAPSHOT (git-2016d148-b436)]
        at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]

Software brand Velocity 3.3.0-SNAPSHOT (git-2016d148-b436)

Plugins velocity, luckperms, librelogin, packetevents, playerstime-velocity, serverlistmanager, sonar, velocity-prometheus-exporter

How To Reproduce The player (non-premium) connects to the server, regardless of the client version. For premium players who are automatically directed to the game server, the error does not occur. There is no visible problem for the player and it does not hinder the joining or playing process.

booky10 commented 1 month ago

Please try and test if PR https://github.com/retrooper/packetevents/pull/1009 fixes this issue You can download the test packetevents build from here