ProtocolLib

3M Downloads

IllegalStateException in PlayerInfoData (1.19.3)

Syrent opened this issue ยท 1 comments

commented
  • This issue is not solved in a development build

Describe the bug
Add a new PlayerInfoData and its throws an IllegalStateException (only on 1.19.3)
Code: https://github.com/Syrent/VelocityVanish/blob/master/src/main/java/ir/syrent/velocityvanish/spigot/core/VanishManager.kt#L63

To Reproduce
Code that throws the exception:

                val tabPacket = DependencyManager.protocolLibHook.protocolManager.createPacket(PacketType.Play.Server.PLAYER_INFO, true)
                val infoData = tabPacket?.playerInfoDataLists
                val infoAction = tabPacket?.playerInfoAction
                val playerInfo = infoData?.read(0)

                playerInfo?.add(
                    PlayerInfoData(
                        WrappedGameProfile.fromPlayer(player),
                        0,
                        NativeGameMode.valueOf(state.name),
                        WrappedChatComponent.fromText(player.playerListName)
                    )
                )

                infoData?.write(0, playerInfo)
                infoAction?.write(0, EnumWrappers.PlayerInfoAction.UPDATE_GAME_MODE)

                val newTabPacket = PacketContainer(PacketType.Play.Server.PLAYER_INFO, tabPacket?.handle)

                for (onlinePlayer in Ruom.getOnlinePlayers()) {
                    if (onlinePlayer.hasPermission("velocityvanish.admin.seevanished")) {
                        if (onlinePlayer == player) continue
                        DependencyManager.protocolLibHook.protocolManager.sendServerPacket(onlinePlayer, newTabPacket)
                    }
                }

Version Info
https://pastebin.com/raw/TgiHAysE

commented

See #2037