Exceptionflug / protocolize

A lightweight BungeeCord / Velocity protocol framework supporting items
MIT License
300 stars 39 forks source link

Error while open Inventory #180

Closed JxstColin closed 1 year ago

JxstColin commented 1 year ago

Error:

15:33:40 [SEVERE] [Protocolize] === EXCEPTION CAUGHT IN DECODER ===
15:33:40 [SEVERE] [Protocolize] Protocolize 2.2.5:584
15:33:40 [SEVERE] [Protocolize] Stream Direction: UPSTREAM
15:33:40 [SEVERE] [Protocolize] Connection: [JxstColin,/127.0.0.1:56077] <-> InitialHandler
15:33:40 [SEVERE] [Protocolize] Protocol version: 47
15:33:40 [SEVERE] io.netty.handler.codec.EncoderException: java.lang.NullPointerException: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "str" is null

15:33:40 [SEVERE]     at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:125)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702)

15:33:40 [SEVERE]     at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:110)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758)

15:33:40 [SEVERE]     at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1020)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:311)

15:33:40 [SEVERE]     at net.md_5.bungee.netty.ChannelWrapper.write(ChannelWrapper.java:60)

15:33:40 [SEVERE]     at net.md_5.bungee.UserConnection$1.sendPacket(UserConnection.java:146)

15:33:40 [SEVERE]     at dev.simplix.protocolize.bungee.player.BungeeCordProtocolizePlayer.sendPacket(BungeeCordProtocolizePlayer.java:57)

15:33:40 [SEVERE]     at dev.simplix.protocolize.api.player.ProtocolizePlayer.openInventory(ProtocolizePlayer.java:110)

15:33:40 [SEVERE]     at eu.jxstcolin.commands.BanCommand.execute(BanCommand.java:27)

15:33:40 [SEVERE]     at net.md_5.bungee.api.plugin.PluginManager.dispatchCommand(PluginManager.java:207)

15:33:40 [SEVERE]     at net.md_5.bungee.api.plugin.PluginManager.dispatchCommand(PluginManager.java:157)

15:33:40 [SEVERE]     at net.md_5.bungee.connection.UpstreamBridge.handleChat(UpstreamBridge.java:188)

15:33:40 [SEVERE]     at net.md_5.bungee.connection.UpstreamBridge.handle(UpstreamBridge.java:150)

15:33:40 [SEVERE]     at net.md_5.bungee.protocol.packet.Chat.handle(Chat.java:71)

15:33:40 [SEVERE]     at net.md_5.bungee.netty.HandlerBoss.channelRead(HandlerBoss.java:114)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)

15:33:40 [SEVERE]     at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)

15:33:40 [SEVERE]     at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)

15:33:40 [SEVERE]     at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)

15:33:40 [SEVERE]     at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)

15:33:40 [SEVERE]     at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327)

15:33:40 [SEVERE]     at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:299)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)

15:33:40 [SEVERE]     at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)

15:33:40 [SEVERE]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)

15:33:40 [SEVERE]     at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)

15:33:40 [SEVERE]     at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)

15:33:40 [SEVERE]     at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)

15:33:40 [SEVERE]     at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)

15:33:40 [SEVERE]     at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)

15:33:40 [SEVERE]     at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)

15:33:40 [SEVERE]     at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995)

15:33:40 [SEVERE]     at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)

15:33:40 [SEVERE]     at java.base/java.lang.Thread.run(Thread.java:832)

15:33:40 [SEVERE] Caused by: java.lang.NullPointerException: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "str" is null

15:33:40 [SEVERE]     at dev.simplix.protocolize.api.util.ProtocolUtil.writeString(ProtocolUtil.java:161)

15:33:40 [SEVERE]     at dev.simplix.protocolize.data.packets.OpenWindow.write(OpenWindow.java:85)

15:33:40 [SEVERE]     at dev.simplix.protocolize.bungee.packet.BungeeCordProtocolizePacket.write(BungeeCordProtocolizePacket.java:64)

15:33:40 [SEVERE]     at net.md_5.bungee.protocol.MinecraftEncoder.encode(MinecraftEncoder.java:24)

15:33:40 [SEVERE]     at net.md_5.bungee.protocol.MinecraftEncoder.encode(MinecraftEncoder.java:9)

15:33:40 [SEVERE]     at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107)

15:33:40 [SEVERE]     ... 58 more

Code:

Inventory inventory = new Inventory(InventoryType.GENERIC_9X3);
ProtocolizePlayer pplayer = Protocolize.playerProvider().player(player.getUniqueId());
pplayer.openInventory(inventory);

Tested Versions:

1.8.8 & 1.16.5

Please help me, how to fix.

Exceptionflug commented 1 year ago

Hey, you have to specify an inventory title.

Duplicate of https://github.com/Exceptionflug/protocolize/issues/174

JxstColin commented 1 year ago

Thanks > Hey, you have to specify an inventory title.

Duplicate of https://github.com/Exceptionflug/protocolize/issues/174