ProtocolLib

3M Downloads

PacketPlayOutPlayerInfo error, after updating

Tankonyako opened this issue ยท 3 comments

commented

Describe the bug
New version of ProtocolLib cause error below, i'm 100% sure this is ProtocolLib error. because on older version all works fine, i was upgraded because this snapshot supports forge mappings.

To Reproduce
Code below cause this error, i was try PacketWrapper and raw code. before i updated ProtocolLib from ProtocolLib 4.4.0 to current version from Jenkins and i got this error, but before upgrading this code was works fine.
Code with ProtocolLib:

/** 130 **/ bed = protocolManager.createPacket(PacketType.Play.Server.BED);
/** 131 **/ bed.getIntegers().write(0, entityId);
/** 132 **/ bed.getBlockPositionModifier().write(0, new BlockPosition(bedLoc.getBlockX(), bedLoc.getBlockY(), bedLoc.getBlockZ()));

Code with ProtocolLib and PacketWrapper:

/** 130 **/ WrapperPlayServerBed bed_wrapper = new WrapperPlayServerBed();
/** 131 **/ bed_wrapper.setEntityID(entityId);
/** 132 **/ bed_wrapper.setLocation(new BlockPosition(bedLoc.getBlockX(), bedLoc.getBlockY(), bedLoc.getBlockZ()));

(old code cause same error)

org.bukkit.event.EventException: null
        at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:69) ~[EventExecutor$2.class:git-CatServer-1.12.2-1973bbc]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[RegisteredListener.class:git-CatServer-1.12.2-1973bbc]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:503) [SimplePluginManager.class:git-CatServer-1.12.2-1973bbc]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:488) [SimplePluginManager.class:git-CatServer-1.12.2-1973bbc]
        at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callEvent(CraftEventFactory.java:132) [CraftEventFactory.class:git-CatServer-1.12.2-1973bbc]
        at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callEntityDamageEvent(CraftEventFactory.java:669) [CraftEventFactory.class:git-CatServer-1.12.2-1973bbc]
        at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.handleEntityDamageEvent(CraftEventFactory.java:655) [CraftEventFactory.class:git-CatServer-1.12.2-1973bbc]
        at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.handleLivingEntityDamageEvent(CraftEventFactory.java:701) [CraftEventFactory.class:git-CatServer-1.12.2-1973bbc]
        at net.minecraft.entity.EntityLivingBase.damageEntity_CB(EntityLivingBase.java:1673) [vp.class:?]
        at net.minecraft.entity.player.EntityPlayer.damageEntity_CB(EntityPlayer.java:1191) [aed.class:?]
        at net.minecraft.entity.EntityLivingBase.func_70097_a(EntityLivingBase.java:1054) [vp.class:?]
        at net.minecraft.entity.player.EntityPlayer.func_70097_a(EntityPlayer.java:1086) [aed.class:?]
        at net.minecraft.entity.player.EntityPlayerMP.func_70097_a(EntityPlayerMP.java:816) [oq.class:?]
        at net.minecraft.entity.EntityLivingBase.func_180430_e(EntityLivingBase.java:1489) [vp.class:?]
        at net.minecraft.entity.player.EntityPlayer.func_180430_e(EntityPlayer.java:2114) [aed.class:?]
        at net.minecraft.block.Block.func_180658_a(Block.java:829) [aow.class:?]
        at net.minecraft.entity.Entity.func_184231_a(Entity.java:1339) [vg.class:?]
        at net.minecraft.entity.EntityLivingBase.func_184231_a(EntityLivingBase.java:263) [vp.class:?]
        at net.minecraft.entity.player.EntityPlayerMP.func_71122_b(EntityPlayerMP.java:1018) [oq.class:?]
        at net.minecraft.network.NetHandlerPlayServer.func_147347_a(NetHandlerPlayServer.java:858) [pa.class:?]
        at net.minecraft.network.play.client.CPacketPlayer.func_148833_a(CPacketPlayer.java:33) [lk.class:?]
        at net.minecraft.network.play.client.CPacketPlayer$Position.func_148833_a(CPacketPlayer.java:76) [lk$a.class:?]
        at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) [hv$1.class:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_231]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_231]
        at net.minecraft.util.Util.func_181617_a(SourceFile:46) [h.class:?]
        at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:838) [MinecraftServer.class:?]
        at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:472) [nz.class:?]
        at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:775) [MinecraftServer.class:?]
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:629) [MinecraftServer.class:?]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_231]
Caused by: com.comphenix.protocol.reflect.FieldAccessException: No field with type int exists in class PacketPlayOutPlayerInfo.
        at com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:363) ~[?:?]
        at com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:343) ~[?:?]
        at com.comphenix.packetwrapper.WrapperPlayServerBed.setEntityID(WrapperPlayServerBed.java:58) ~[?:?]
        at ******************************************************(******.java:131) ~[?:?]
        at ******************************************************(******..java:66) ~[?:?]
        at ************************************************************************(******.java:134) ~[?:?]
        at catserver.server.executor.asm.generated.GeneratedEventExecutor110.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:67) ~[EventExecutor$2.class:git-CatServer-1.12.2-1973bbc]
        ... 30 more

Expected behavior
Packed who create bed for laying.

Version Info
https://pastebin.com/kM5ATUyb (ProtocolLib v4.6.0-SNAPSHOT-b464)

Additional context
https://pastebin.com/KDuwrVDk - Also PacketPlayOutPlayerInfo.PlayerInfoData from my server, and class has int fields.

commented

you tried to write to PacketPlayOutPlayerInfo, you want to write to PlayerInfoData, which is a field of the packet.

the actual bed packet you want has been removed in 1.14, thats why it appears like PL is picking the wrong packet, but its actually helping you.

commented

you tried to write to PacketPlayOutPlayerInfo, you want to write to PlayerInfoData, which is a field of the packet.

the actual bed packet you want has been removed in 1.14, thats why it appears like PL is picking the wrong packet, but its actually helping you.

i'm using a 1.12.2 version of CatServer. i was find an issue about forge hybrid servers and update ProtocolLibbecause for this reason.
how to write to PlayerInfoData in 1.12.2 for bed packet on new snapshots of ProtocolLib?

commented

I came up with the same issue using this with CatServer.
And I solved this by replacing the ProtocolLib plugin with this version on my server.