List converter not compatible with singleton lists
games647 opened this issue ยท 4 comments
Original ticket at: games647/ChangeSkin#227
Describe the bug
List converter at
cannot find available constructors for singleton lists, because there are no empty constructors.
To Reproduce
Steps to reproduce the behavior:
removeInfo = new PacketContainer(PLAYER_INFO);
removeInfo.getPlayerInfoAction().write(0, PlayerInfoAction.REMOVE_PLAYER);
removeInfo.getPlayerInfoDataLists().write(0, Collections.singletonList(playerInfoData));
Error
https://pastebin.com/vyYt4j8x
Should singleton lists be forbidden or is it just an bug? Earlier < 4.7 seemed to work fine. Potential problematic commit: 153dd61.
Few questions:
- The paste is no longer accesible. Is it by any chance something similar to this? https://paste.helpch.at/ufufixugox.md
- Does the commit 4c0c18d "fix" this issue or will plugins still need to apply a workaround?
My guess is the later because I encounter those exact issues here with a plugin while using latest dev build.
- It appears so
- It was only a debug message. If ProtocolLib fails to create the list object it will fallback to create a new ArrayList instead. At this step the exception got printed. No changes are required here, because of the fallback. However, by passing an already working type, you don't have the overhead of the exception.
Yeah that's just a debug message I accidentally left in. You should be good to keep using it, but fwiw I would recommend using an array list instead because it'll be slightly more efficient. There's not going to be any functional difference