ProtocolLib

3M Downloads

NoSuchElementException in folia 1.20.4

Yellowstrawberrys opened this issue ยท 3 comments

commented
  • This issue is not solved in a development build

Describe the bug
When I try to create packet using ProtocolManager#createPacket, it produces error.

Caused by: java.util.NoSuchElementException: No value present
        at java.util.Optional.get(Optional.java:143) ~[?:?]
        at com.comphenix.protocol.wrappers.WrappedChatComponent.<clinit>(WrappedChatComponent.java:49) ~[ProtocolLib.jar:?]
        ... 33 more

Here's line that produced error:

PacketContainer openSign = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.OPEN_SIGN_EDITOR);

Version Info
Folia 1.20.4 9a389a1
https://pastebin.com/AeK42LJv

commented

Here is full stack trace:
https://pastebin.com/zr2cabT0

And here is code snippet:
https://pastebin.com/nb9HQQ7V

commented

Hi, please share to Code snippet and the full stack trace of this exception

commented

Hi,

thank you for sharing the information. The cause of the problem is probably that you are running a MC server with Mojang Mappings and not spigot mappings.
ProtocolLib currently only uses the Spigot Mapping of the required class name in https://github.com/dmulloy2/ProtocolLib/blob/master/src/main/java/com/comphenix/protocol/wrappers/WrappedChatComponent.java#L28.

I will see if I can reproduce this and fix the problem in the next couple of days