ProtocolLib

3M Downloads

TinyProtocol reflection issues in 1.17+

CJCrafter opened this issue ยท 0 comments

commented

Describe the bug
In 1.17 and higher, it seems that the pending field (Holding the network markers) is no longer accessible through the static method previously used. It seems that the method no longer exists. https://github.com/dmulloy2/ProtocolLib/blob/master/TinyProtocol/src/main/java/com/comphenix/tinyprotocol/TinyProtocol.java#L58

To Reproduce
Try to reflectively get a method invoker for the static List a(ServerConnection) in the ServerConnection class. This is what TinyProtocol does on line 58. Since this method no longer exists in 1.17, it will fail during runtime.

Expected behavior
We'd expect to be able to access these network markers.

Here, in 1.13, is the method that TinyProtocol used to use.
image

However, when running the same code in 1.17, we get an exception.

Caused by: java.lang.IllegalArgumentException: Cannot find method with return=interface java.util.Collection, params=[class net.minecraft.server.network.ServerConnection]
        at me.deecaad.core.utils.ReflectionUtil.getMethod(ReflectionUtil.java:430) ~[?:?]

Additional context
I am not using TinyProtocol line for line, I made my own packet listener heavily based off of TinyProtocol. This should be an issue in both versions. As a sidenote, that reflection should look for a collection, not a list, since paper turns it into a LinkedBlockingQueue.