ProtocolLib

3M Downloads

Exception Occurs when trying to create a new ScoreboardTeam

xXkguyXx opened this issue ยท 3 comments

commented

Hello, I am seeing a weird bug with the latest version of ProtocolLib that was not present previously.

Server is running version 1.19.4.
ProtocolLib is latest dev build.

The code I am using is from lucko's helper library.
Specifically, https://github.com/lucko/helper/blob/master/helper/src/main/java/me/lucko/helper/scoreboard/PacketScoreboardTeam.java#L390

I get the following exception (that was not present when I switch back to my old ProtocolLib jar from around December of 2023):

java.util.NoSuchElementException: No value present
at java.util.Optional.get(Optional.java:143) ~[?:?]
at xxx.xxx.xxx.PacketScoreboardTeam.newUpdatePacket(PacketScoreboardTeam.java:369) ~[xxx.jar:?]

Line numbers won't match link to code I sent exactly because I have custom version with slight tweaks for my usecase.

commented

Did some investigating (I don't know the cause yet) but I think it's related to this other issue: #3057

I was able to get this exception to happen when Instead of doing new new PacketContainer(PacketType.Play.Server.SCOREBOARD_TEAM); I did ProtocolLibrary.getProtocolManager().createPacket().

Now the different seems to be this .writeDefaults() thing... (which it appears SimpleScore does): https://github.com/r4g3baby/SimpleScore/blob/main/src/main/kotlin/com/r4g3baby/simplescore/scoreboard/handlers/ProtocolScoreboard.kt#L61

commented

Hi - Just hoping to see if there's any update.

commented

Fixed - API was changed and old one broke in new version of protocollib