ProtocolLib

3M Downloads

IllegalStateException when running MC 1.20.3 and 1.20.4 ?

Jeppa opened this issue ยท 4 comments

commented
  • This issue is not solved in a development build

When I try to get 'PlayerInfoData' using the wrapper i get a crash.
The same code works fine under 1.20.2 and below.

I tried to use two different syntaxes for it, both with the same result!
1.: PlayerInfoData.PlayerInfoData(UUID, int, boolean, NativeGameMode, WrappedGameProfile, WrappedChatComponent)
2.: PlayerInfoData.PlayerInfoData(WrappedGameProfile, int, NativeGameMode, WrappedChatComponent)

Version Info
ProtocolLib version is build #673, Spigot is 1.20.3 build from 12/5/23

Crash/Error:
java.lang.IllegalStateException: Unable to invoke method public static java.lang.Object net.minecraft.util.ChatDeserializer.a(com.google.gson.Gson,java.lang.String,java.lang.Class,boolean)
at com.comphenix.protocol.reflect.accessors.DefaultMethodAccessor.invoke(DefaultMethodAccessor.java:25) ~[?:?]
at com.comphenix.protocol.wrappers.WrappedChatComponent.deserialize(WrappedChatComponent.java:63) ~[?:?]
at com.comphenix.protocol.wrappers.WrappedChatComponent.fromJson(WrappedChatComponent.java:94) ~[?:?]
at com.comphenix.protocol.wrappers.WrappedChatComponent.fromText(WrappedChatComponent.java:115) ~[?:?]
....
Caused by: com.google.gson.JsonIOException: Interfaces can't be instantiated! Register an InstanceCreator or a TypeAdapter for this type. Interface name: net.minecraft.network.chat.IChatBaseComponent
at com.google.gson.internal.ConstructorConstructor$3.construct(ConstructorConstructor.java:136) ~[gson-2.10.1.jar:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.createAccumulator(ReflectiveTypeAdapterFactory.java:427) ~[gson-2.10.1.jar:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:383) ~[gson-2.10.1.jar:?]
at net.minecraft.util.ChatDeserializer.a(SourceFile:527) ~[spigot-1.20.3-R0.1-SNAPSHOT.jar:3952-Spigot-9d72885-8232a74]
at net.minecraft.util.ChatDeserializer.b(SourceFile:534) ~[spigot-1.20.3-R0.1-SNAPSHOT.jar:3952-Spigot-9d72885-8232a74]
at net.minecraft.util.ChatDeserializer.a(SourceFile:566) ~[spigot-1.20.3-R0.1-SNAPSHOT.jar:3952-Spigot-9d72885-8232a74]
at com.comphenix.protocol.reflect.accessors.DefaultMethodAccessor.invoke(DefaultMethodAccessor.java:23) ~[?:?]
... 14 more

commented

Not fixed #2885

commented

I Found the 'reason' ...
I use the following to get the WrappedChatComponent:
com.comphenix.protocol.wrappers.WrappedChatComponent.fromText(entity.getCustomName())
That throws the error...

but com.comphenix.protocol.wrappers.WrappedChatComponent.fromLegacyText(entity.getCustomName())
seems to work...

commented

Updated ProtocolLib fixed it ;)

commented

Thanks