ProtocolLib

3M Downloads

🚨 [ProtocolLib v5.0.0] Unable to create an instance of PacketLoginInStart packet using the latest dev build

nickuc opened this issue · 2 comments

commented
  • This issue is not solved in a development build

Describe the bug
Unable to create an instance of PacketLoginInStart packet using the latest dev build (https://ci.dmulloy2.net/job/ProtocolLib/602/). Works perfectly when using stable version (4.8.0).

I think the problem is because it is using the default WrappedGameProfile, but I didn't find any way to set it when creating the PacketContainer.

To Reproduce
Try to create an instance of the PacketLoginInStart packet, like the code in the Additional context section

Expected behavior
Being able to create the PacketLoginInStart instance without errors.

Version Info
Provide your ProtocolLib install info with /protocol dump through pastebin.

Additional context

Stacktrace:

java.lang.IllegalStateException: Unable to construct new instance using public net.minecraft.network.protocol.login.PacketLoginInStart(net.minecraft.network.PacketDataSerializer)
        at com.comphenix.protocol.reflect.accessors.DefaultConstrutorAccessor.invoke(DefaultConstrutorAccessor.java:21) ~[ProtocolLib.jar:?]
        at com.comphenix.protocol.injector.StructureCache.lambda$newPacket$0(StructureCache.java:73) ~[ProtocolLib.jar:?]
        at com.comphenix.protocol.injector.StructureCache.newPacket(StructureCache.java:85) ~[ProtocolLib.jar:?]
        at com.comphenix.protocol.injector.StructureCache.newPacket(StructureCache.java:95) ~[ProtocolLib.jar:?]
        at com.comphenix.protocol.events.PacketContainer.<init>(PacketContainer.java:117) ~[ProtocolLib.jar:?]
        at com.nickuc.login.ζΠΨθμδμθγκΣηω.a(:64) ~[?:?]
        at com.nickuc.login.ςμκΔΣιζρΛξΨιθφΠ.c(:204) ~[?:?]
        at com.nickuc.login.ςμκΔΣιζρΛξΨιθφΠ.run(:138) ~[?:?]
        at org.bukkit.craftbukkit.v1_18_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.18.2.jar:git-Paper-388]
        at org.bukkit.craftbukkit.v1_18_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[paper-1.18.2.jar:git-Paper-388]
        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[paper-1.18.2.jar:git-Paper-388]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalArgumentException: Name and ID cannot both be blank
        at com.mojang.authlib.GameProfile.<init>(GameProfile.java:26) ~[authlib-3.3.39.jar:?]
        at net.minecraft.network.protocol.login.ServerboundHelloPacket.<init>(ServerboundHelloPacket.java:16) ~[?:?]
        at com.comphenix.protocol.reflect.accessors.DefaultConstrutorAccessor.invoke(DefaultConstrutorAccessor.java:19) ~[ProtocolLib.jar:?]
        ... 13 more

I'm using the code below:

PacketContainer startPacket = new PacketContainer(START); // <---------- ⚠️ STACKTRACE LINE ⚠️

startPacket.getGameProfiles().write(0, originalPacket.getGameProfiles().read(0));
commented

image

commented

Fixed in latest version