Skip to content

user.receivePacketSilently on bungeecord throws exception #1465

@diogotcorreia

Description

@diogotcorreia

Describe the bug

The following code doesn't work correctly on BungeeCord:

WrapperPlayClientChatCommandUnsigned packet = new WrapperPlayClientChatCommandUnsigned("help");
user.receivePacketSilently(packet);

When this code is ran on BungeeCord, the following exception is thrown and the player is kicked:

11:29:38 [SEVERE] [Rexcantor64] -> UpstreamBridge - encountered exception
java.lang.ClassCastException: class io.netty.buffer.PooledUnsafeDirectByteBuf cannot be cast to class net.md_5.bungee.protocol.PacketWrapper (io.netty.buffer.PooledUnsafeDirectByteBuf and net.md_5.bungee.protocol.PacketWrapper are in unnamed module of loader 'app')
        at net.md_5.bungee.netty.HandlerBoss.channelRead(HandlerBoss.java:117)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:356)
        at io.netty.channel.AbstractChannelHandlerContext.lambda$fireChannelRead$2(AbstractChannelHandlerContext.java:365)
        at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:148)
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:141)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:535)
        at io.netty.channel.SingleThreadIoEventLoop.run(SingleThreadIoEventLoop.java:201)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:1193)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at java.base/java.lang.Thread.run(Thread.java:1583)
11:29:38 [INFO] [Rexcantor64] disconnected with: ClassCastException : class io.netty.buffer.PooledUnsafeDirectByteBuf cannot be cast to class net.md_5.bungee.protocol.PacketWrapper (io.netty.buffer.PooledUnsafeDirectByteBuf and net.md_5.bungee.protocol.PacketWrapper are in unnamed module of loader 'app') @ net.md_5.bungee.netty.HandlerBoss:117

Software brand
BungeeCord git:BungeeCord-Bootstrap:1.21-R0.5-SNAPSHOT:7d6516e:2017

Plugins
LuckPerms 5.5.24
Triton 4.0.0-SNAPSHOT (from PR tritonmc/Triton#585 commit tritonmc/Triton@33c3c25)

Using PacketEvents 2.11.2, which is being shaded into Triton.

How To Reproduce
Steps to reproduce the behavior:

  1. Join the server
  2. Trigger the above code
  3. Get kicked

Expected behavior
The expected behaviour should be the same as on Velocity, where this works fine, and show the help menu:

Image

Additional context
I have also tried receivePacket instead of receivePacketSilently, which does not kick the player immediately, but only after a while.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions