java.lang.IndexOutOfBoundsException: readerIndex(798) + length(1) exceeds writerIndex(798): PooledUnsafeDirectByteBuf(ridx: 798, widx: 798, cap: 1024)
Describe the bug When a player uses the "/warp" or "/spawn" command to teleport from the End or Nether world back to a world that utilizes plugins with the PacketEvents API (such as the main city world), the server throws an IndexOutOfBoundsException related to the PacketEvents plugin, causing the player to disconnect.
Software brand Leaf 1.21.1
Plugins ProtocolLib PacketEvents 2.8.0-SNAPSHOT ESU-bukkit 0.3.0 TrMenu 3.3.4-beta5 ModelEngine R4.0.8 TAB v4.1.8 MythicMobs 5.9.0 MagicCosmetics 3.1.0 CustomNameplates 3.0.1 CMI 9.7.13.0
How To Reproduce Steps to reproduce the behavior: Install the above plugins on the server. Have a player join the server and go to either the End or Nether world. Let the player use the “/warp” or “/spawn” command to teleport back to a world that uses plugins with the PacketEvents API, such as the main city world. The player will be disconnected due to the error.
Expected behavior The player should be teleported back to the main city world without any errors or disconnections.
Screenshots No screenshots provided.
Additional context The error seems to be caused by a plugin in the main city world that uses the PacketEvents API. It might be due to version incompatibility or a bug in the plugin.
@MIKAZE3 please send the actual stacktrace and ensure packetevents is up-to-date
This issue can be closed.
This happens when a packet is created multiple times from the same event. Events need to be cloned to prevent this.
I don't quite understand why this decision was made after 2.8.1, but it works if the event is only “deconstructed” once.
@booky10 @retrooper can be closed ig?