ProtocolLib

3M Downloads

PlayerInfoData cast problem

alexdev03 opened this issue · 2 comments

commented

Hi, I created a custom plugin for tab for 1.16 and 1.18, today I wanted to update it to 1.19 but I encountered this problem

[18:03:04] [Craft Scheduler Thread - 5 - RedisTab/INFO]: [RedisTab] [STDOUT] Read ClientboundPlayerInfoUpdatePacket{actions=[ADD_PLAYER, UPDATE_LISTED, UPDATE_DISPLAY_NAME], entries=[b[profileId=5907f2d1-2590-45cc-8253-401abf69dc14, profile=com.mojang.authlib.GameProfile@26f76814[id=5907f2d1-2590-45cc-8253-401abf69dc14,name=AlexDev_,properties={textures=[com.mojang.authlib.properties.Property@24174182]},legacy=false], listed=true, latency=0, gameMode=SURVIVAL, displayName=empty[style={}, siblings=[literal{◈ }[style={color=yellow,!bold,!italic,!underlined,!strikethrough,!obfuscated}], literal{a}[style={color=#FBE200,!bold,!italic,!underlined,!strikethrough,!obfuscated}], literal{d}[style={color=#CAAF3F,!bold,!italic,!underlined,!strikethrough,!obfuscated}], literal{m}[style={color=#997C7F,!bold,!italic,!underlined,!strikethrough,!obfuscated}], literal{i}[style={color=#6748BE,!bold,!italic,!underlined,!strikethrough,!obfuscated}], literal{n ◈ }[style={color=#3615FD,!bold,!italic,!underlined,!strikethrough,!obfuscated}], literal{c}[style={color=#084CFB,!bold,!italic,!underlined,!strikethrough,!obfuscated}], literal{i}[style={color=#3F84FC,!bold,!italic,!underlined,!strikethrough,!obfuscated}], literal{a}[style={color=#76BBFC,!bold,!italic,!underlined,!strikethrough,!obfuscated}], literal{o AlexDev_}[style={color=#ADF3FD,!bold,!italic,!underlined,!strikethrough,!obfuscated}]]], chatSession=null]]} [18:03:04] [Craft Scheduler Thread - 5 - RedisTab/WARN]: Nag author(s): '[AlexDev_]' of 'RedisTab v4.4-EXPERIMENTAL' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger). [18:03:04] [Craft Scheduler Thread - 5 - RedisTab/WARN]: [RedisTab] Plugin RedisTab v4.4-EXPERIMENTAL generated an exception while executing task 50 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 (16).jar:?] at com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:359) ~[ProtocolLib (16).jar:?] at com.comphenix.protocol.reflect.StructureModifier.writeSafely(StructureModifier.java:335) ~[ProtocolLib (16).jar:?] at org.metadevs.redistab.redistab.redis.RedisImpl.lambda$publishPlayerInfo$17(RedisImpl.java:323) ~[RedisTabSpigot-4.4-EXPERIMENTAL.jar:?] at org.metadevs.redistab.redistab.redis.redisdata.RedisAbstract.getBinaryConnectionAsync(RedisAbstract.java:38) ~[RedisTabSpigot-4.4-EXPERIMENTAL.jar:?] at org.metadevs.redistab.redistab.redis.RedisImpl.publishPlayerInfo(RedisImpl.java:309) ~[RedisTabSpigot-4.4-EXPERIMENTAL.jar:?] at org.metadevs.redistab.redistab.task.UpdateTask.run(UpdateTask.java:94) ~[RedisTabSpigot-4.4-EXPERIMENTAL.jar:?] at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.4.jar:git-Paper-550] at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[paper-1.19.4.jar:git-Paper-550] at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[paper-1.19.4.jar:?] 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.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 (16).jar:?] ... 12 more

I tried with the latest build on spigot and also the latest dev build. The server is on latest paper 1.19.4 build.

Error also on pastebin

commented

Ok thanks, I tried and it seems to work.

commented

The internal structure of the PlayerInfo Packe changed with 1.19. Instead of one single action, it now stores a set of actions (e.g. update latency or update display name) and only the fields required by the actions will be sent to the client. You can find an example on how to do this in 1.19.4 here: https://github.com/lukalt/PacketWrapper/blob/master/src/main/java/com/comphenix/packetwrapper/wrappers/play/clientbound/WrapperPlayServerPlayerInfo.java