Player Info Packet Error
Xiao-MoMi opened this issue · 4 comments
Describe the bug
java.lang.IllegalStateException: Unable to set value of field private final java.util.EnumSet net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket.a
at com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor.set(DefaultFieldAccessor.java:44) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:358) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:321) ~[ProtocolLib.jar:?]
at net.momirealms.customnameplates.paper.mechanic.nameplate.tag.listener.PlayerInfoListener.onPacketSending(PlayerInfoListener.java:50) ~[CustomNameplates-paper-2.3.0.0-beta-5.jar:?]
at com.comphenix.protocol.injector.SortedPacketListenerList.invokeSendingListener(SortedPacketListenerList.java:219) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.SortedPacketListenerList.invokeUnpackedPacketSending(SortedPacketListenerList.java:204) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:149) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:139) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.PacketFilterManager.postPacketToListeners(PacketFilterManager.java:553) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:526) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.netty.manager.NetworkManagerInjector.onPacketSending(NetworkManagerInjector.java:100) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.netty.channel.NettyChannelInjector.processOutbound(NettyChannelInjector.java:553) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.netty.channel.NettyChannelInjector$2.doProxyRunnable(NettyChannelInjector.java:456) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.netty.channel.NettyEventLoopProxy.proxyRunnable(NettyEventLoopProxy.java:43) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.netty.channel.NettyEventLoopProxy.execute(NettyEventLoopProxy.java:252) ~[ProtocolLib.jar:?]
at net.minecraft.network.Connection.sendPacket(Connection.java:432) ~[?:?]
at net.minecraft.network.Connection.send(Connection.java:392) ~[?:?]
at net.minecraft.server.network.ServerCommonPacketListenerImpl.send(ServerCommonPacketListenerImpl.java:255) ~[paper-1.20.4.jar:git-Paper-393]
at net.minecraft.server.network.ServerCommonPacketListenerImpl.send(ServerCommonPacketListenerImpl.java:240) ~[paper-1.20.4.jar:git-Paper-393]
at net.minecraft.server.players.PlayerList.placeNewPlayer(PlayerList.java:369) ~[paper-1.20.4.jar:git-Paper-393]
at net.minecraft.server.network.ServerConfigurationPacketListenerImpl.handleConfigurationFinished(ServerConfigurationPacketListenerImpl.java:130) ~[paper-1.20.4.jar:git-Paper-393]
at net.minecraft.network.protocol.configuration.ServerboundFinishConfigurationPacket.handle(ServerboundFinishConfigurationPacket.java:18) ~[paper-1.20.4.jar:git-Paper-393]
at net.minecraft.network.protocol.configuration.ServerboundFinishConfigurationPacket.a(ServerboundFinishConfigurationPacket.java:9) ~[paper-1.20.4.jar:git-Paper-393]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:54) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.20.4.jar:git-Paper-393]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1452) ~[paper-1.20.4.jar:git-Paper-393]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:194) ~[paper-1.20.4.jar:git-Paper-393]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1429) ~[paper-1.20.4.jar:git-Paper-393]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1352) ~[paper-1.20.4.jar:git-Paper-393]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1330) ~[paper-1.20.4.jar:git-Paper-393]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1220) ~[paper-1.20.4.jar:git-Paper-393]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:321) ~[paper-1.20.4.jar:git-Paper-393]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.ClassCastException: Cannot cast java.util.ArrayList to java.util.EnumSet
at java.lang.Class.cast(Class.java:3889) ~[?:?]
at com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor.set(DefaultFieldAccessor.java:41) ~[ProtocolLib.jar:?]
... 36 more
To Reproduce
Steps to reproduce the behavior:
public void onPacketSending(PacketEvent event) {
PacketContainer packet = event.getPacket();
List<PlayerInfoData> list = packet.getPlayerInfoDataLists().read(0);
packet.getPlayerInfoDataLists().write(0, list);
}
Version Info
[03:45:29 INFO]: ProtocolLib version 5.2.0-SNAPSHOT-679
[03:45:29 INFO]: Provides read/write access to the Minecraft protocol.
[03:45:29 INFO]: Authors: dmulloy2 and comphenix
I believe this is a bug, it is trying to write to the actions
field instead of the entries
field because the actions
field happens to be a Collection
as well, so the field accessor gets included. Writing to index 1
seems to have worked for me specifically for the player info update packet.
I believe this is a bug, it is trying to write to the
actions
field instead of theentries
field because theactions
field happens to be aCollection
as well, so the field accessor gets included. Writing to index1
seems to have worked for me specifically for the player info update packet.
Could you provide a snippet? I am unable to get this working.
I believe this is a bug, it is trying to write to the
actions
field instead of theentries
field because theactions
field happens to be aCollection
as well, so the field accessor gets included. Writing to index1
seems to have worked for me specifically for the player info update packet.
Having the same issue here. Snippet would be appreciated
EDIT: This is the solution
public void onPacketSending(PacketEvent event) {
PacketContainer packet = event.getPacket();
List<PlayerInfoData> list = packet.getPlayerInfoDataLists().read(1);
packet.getPlayerInfoDataLists().write(1, list);
}