Replace trackerEntry.getClass() in the linked ProtocolLib code with PlayerChunkMap.EntityTracker.class or an equivalent value
mibby opened this issue ยท 0 comments
Paper dev 156 (Spigot 1.14.4)
ProtocolLib-Gradle dev 14
HolographicDisplay dev 86
Citizens dev 1738
RE: filoghost/HolographicDisplays#135 (comment)
Code in ProtocolLib that threw the exception:
https://github.com/dmulloy2/ProtocolLib/blob/gradle/src/main/java/com/comphenix/protocol/injector/EntityUtilities.java#L200-L216
trackerField = Accessors.getFieldAccessor(trackerEntry.getClass(), "tracker", true);
// ...
tracker = trackerField.get(trackerEntry); // Exception here
Which tracks from there into here: https://github.com/dmulloy2/ProtocolLib/blob/gradle/src/main/java/com/comphenix/protocol/reflect/accessors/DefaultFieldAccessor.java#L15
I'm not completely sure about this, but I think trackerField got set to the Citizens class's field (by way of the first tracker being passed into it being one generated by Citizens), and is then being used to read against vanilla instances of the class (which are of course incompatible with that reflection lookup).
The solution would be to replace trackerEntry.getClass() in the linked ProtocolLib code with PlayerChunkMap.EntityTracker.class or an equivalent value like a Class.forName call (ie: explicitly use the class it's meant to work with, rather than trying to dynamically hack it).
It looks like trackerEntry is assigned differently with 1.14 than below. My guess is the actual fault lies somewhere in here. Just noting so I can look at it in a bit.
https://paste.ubuntu.com/p/dFwmDJFSQF/
https://paste.ubuntu.com/p/HBFtdsbRpS/
[17:44:20] [Server thread/ERROR]: [HolographicDisplays] Unhandled exception number 8192 occured in onPacketSending(PacketEvent) for HolographicDisplays
java.lang.RuntimeException: Cannot retrieve entity from ID.
at com.comphenix.protocol.wrappers.BukkitConverters$9.getSpecific(BukkitConverters.java:648) ~[?:?]
at com.comphenix.protocol.wrappers.BukkitConverters$9.getSpecific(BukkitConverters.java:627) ~[?:?]
at com.comphenix.protocol.reflect.StructureModifier.readInternal(StructureModifier.java:227) ~[?:?]
at com.comphenix.protocol.reflect.StructureModifier.read(StructureModifier.java:195) ~[?:?]
at com.gmail.filoghost.holographicdisplays.bridge.protocollib.current.packet.WrapperPlayServerEntityMetadata.getEntity(WrapperPlayServerEntityMetadata.java:65) ~[?:?]
at com.gmail.filoghost.holographicdisplays.bridge.protocollib.current.packet.WrapperPlayServerEntityMetadata.getEntity(WrapperPlayServerEntityMetadata.java:74) ~[?:?]
at com.gmail.filoghost.holographicdisplays.bridge.protocollib.current.ProtocolLibHookImpl$1.onPacketSending(ProtocolLibHookImpl.java:173) ~[?:?]
at com.comphenix.protocol.injector.SortedPacketListenerList.invokeSendingListener(SortedPacketListenerList.java:195) ~[?:?]
at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:149) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager.handlePacket(PacketFilterManager.java:588) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:564) ~[?:?]
at com.comphenix.protocol.injector.netty.ProtocolInjector.packetQueued(ProtocolInjector.java:338) ~[?:?]
at com.comphenix.protocol.injector.netty.ProtocolInjector.onPacketSending(ProtocolInjector.java:298) ~[?:?]
at com.comphenix.protocol.injector.netty.ChannelInjector.processSending(ChannelInjector.java:364) ~[?:?]
at com.comphenix.protocol.injector.netty.ChannelInjector.access$800(ChannelInjector.java:63) ~[?:?]
at com.comphenix.protocol.injector.netty.ChannelInjector$3.handleScheduled(ChannelInjector.java:329) ~[?:?]
at com.comphenix.protocol.injector.netty.ChannelInjector$3.onMessageScheduled(ChannelInjector.java:299) ~[?:?]
at com.comphenix.protocol.injector.netty.ChannelProxy$2.schedulingRunnable(ChannelProxy.java:127) ~[?:?]
at com.comphenix.protocol.injector.netty.EventLoopProxy.execute(EventLoopProxy.java:95) ~[?:?]
at net.minecraft.server.v1_14_R1.NetworkManager.b(NetworkManager.java:200) ~[patched_1.14.4.jar:git-Paper-156]
at net.minecraft.server.v1_14_R1.NetworkManager.sendPacket(NetworkManager.java:169) ~[patched_1.14.4.jar:git-Paper-156]
at net.minecraft.server.v1_14_R1.PlayerConnection.a(PlayerConnection.java:1521) ~[patched_1.14.4.jar:git-Paper-156]
at net.minecraft.server.v1_14_R1.PlayerConnection.sendPacket(PlayerConnection.java:1494) ~[patched_1.14.4.jar:git-Paper-156]
at net.minecraft.server.v1_14_R1.PlayerChunkMap$EntityTracker.broadcast(PlayerChunkMap.java:1336) ~[patched_1.14.4.jar:git-Paper-156]
at net.minecraft.server.v1_14_R1.EntityTrackerEntry.broadcastIncludingSelf(EntityTrackerEntry.java:389) ~[patched_1.14.4.jar:git-Paper-156]
at net.minecraft.server.v1_14_R1.EntityTrackerEntry.c(EntityTrackerEntry.java:351) ~[patched_1.14.4.jar:git-Paper-156]
at net.minecraft.server.v1_14_R1.EntityTrackerEntry.a(EntityTrackerEntry.java:199) ~[patched_1.14.4.jar:git-Paper-156]
at net.minecraft.server.v1_14_R1.PlayerChunkMap.g(PlayerChunkMap.java:1195) ~[patched_1.14.4.jar:git-Paper-156]
at net.minecraft.server.v1_14_R1.ChunkProviderServer.tickChunks(ChunkProviderServer.java:500) ~[patched_1.14.4.jar:git-Paper-156]
at net.minecraft.server.v1_14_R1.ChunkProviderServer.tick(ChunkProviderServer.java:389) ~[patched_1.14.4.jar:git-Paper-156]
at net.minecraft.server.v1_14_R1.WorldServer.doTick(WorldServer.java:267) ~[patched_1.14.4.jar:git-Paper-156]
at net.minecraft.server.v1_14_R1.MinecraftServer.b(MinecraftServer.java:1207) ~[patched_1.14.4.jar:git-Paper-156]
at net.minecraft.server.v1_14_R1.DedicatedServer.b(DedicatedServer.java:420) ~[patched_1.14.4.jar:git-Paper-156]
at net.minecraft.server.v1_14_R1.MinecraftServer.a(MinecraftServer.java:1074) ~[patched_1.14.4.jar:git-Paper-156]
at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:918) ~[patched_1.14.4.jar:git-Paper-156]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
Caused by: com.comphenix.protocol.reflect.FieldAccessException: Cannot find entity from ID 926.
at com.comphenix.protocol.injector.EntityUtilities.getEntityFromID(EntityUtilities.java:232) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager.getEntityFromID(PacketFilterManager.java:932) ~[?:?]
at com.comphenix.protocol.wrappers.BukkitConverters$9.getSpecific(BukkitConverters.java:642) ~[?:?]
... 35 more
Caused by: java.lang.RuntimeException: Cannot read private final net.minecraft.server.v1_14_R1.Entity net.citizensnpcs.nms.v1_14_R1.util.PlayerlistTracker.tracker
at com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor.get(DefaultFieldAccessor.java:17) ~[?:?]
at com.comphenix.protocol.injector.EntityUtilities.getEntityFromID(EntityUtilities.java:226) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager.getEntityFromID(PacketFilterManager.java:932) ~[?:?]
at com.comphenix.protocol.wrappers.BukkitConverters$9.getSpecific(BukkitConverters.java:642) ~[?:?]
... 35 more
Caused by: java.lang.IllegalArgumentException: Can not set final net.minecraft.server.v1_14_R1.Entity field net.citizensnpcs.nms.v1_14_R1.util.PlayerlistTracker.tracker to net.minecraft.server.v1_14_R1.PlayerChunkMap$EntityTracker
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) ~[?:1.8.0_222]
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) ~[?:1.8.0_222]
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:58) ~[?:1.8.0_222]
at sun.reflect.UnsafeQualifiedObjectFieldAccessorImpl.get(UnsafeQualifiedObjectFieldAccessorImpl.java:38) ~[?:1.8.0_222]
at java.lang.reflect.Field.get(Field.java:393) ~[?:1.8.0_222]
at com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor.get(DefaultFieldAccessor.java:15) ~[?:?]
at com.comphenix.protocol.injector.EntityUtilities.getEntityFromID(EntityUtilities.java:226) ~[?:?]
at com.comphenix.protocol.injector.PacketFilterManager.getEntityFromID(PacketFilterManager.java:932) ~[?:?]
at com.comphenix.protocol.wrappers.BukkitConverters$9.getSpecific(BukkitConverters.java:642) ~[?:?]
... 35 more