[SPIGOT-7510] More issues from CraftMetaSkull being updated Created: 25/Oct/23  Updated: 25/Dec/24  Resolved: 26/Oct/23

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Epic Ebic Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None

Attachments: Text File after coll fix - 3923 - crash.txt     Text File after coll fix - 3923.log     Text File md changes - 3920.log     Text File pre md changes - 3919.log    
Version:  This server is running CraftBukkit version 3920-Spigot-dba3cdc-f4d977e (MC: 1.20.2) (Implementing API version 1.20.2-R0.1-SNAPSHOT) & This server is running CraftBukkit version 3923-Spigot-dba3cdc-224f733 (MC: 1.20.2) (Implementing API version 1.20.2-R
Plugin: ChestSort
Guidelines Read: Yes

 Description   

in mds commit https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/f4d977e794bc39db94711cd0b66addc92b8c3a3c he changed something which caused an npe for null profiles, that got fixed in https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/224f733ac1097f3b250d8da0d4e8a82cfde2f895 by coll but instead of an npe it crashes. Logs attached with names, used revs 3920 for mds commit and 3923 for colls.



 Comments   
Comment by Epic Ebic [ 26/Oct/23 ]

Yeah it works as intended with that but all i would say is a delay should be added due to things having multiple heads in which would cause console spam

Comment by Marvin Rieple [ 26/Oct/23 ]

I made a PR craftbukkit#1286 with a proposed fix for this.

It is currently untested and it would be helpful if you can test it.
You can use BuildTools for it:

java -jar BuildTools.jar --rev 3924 --compile SPIGOT --pr craftbukkit:1286
Comment by Epic Ebic [ 26/Oct/23 ]

I would have to take the guess it is probably caused by the reflection usage, but with that being the only accessable way in 1.16 or prior api there isnt a way for it to not use it so any plugin designed for pre 1.18 would break causing issues with backwards compat for a handleful of plugins, whether this is something that should be left in or fixed to retain compat is probably up to md, ill try and create a simple reproduction tomorrow to confirm if its the reflection or it is actually the api being broken

Comment by blablubbabc [ 25/Oct/23 ]

The crash seems to be caused by some item tag being null. I currently suspect that maybe the skull-owner tag is null, which is set to the "serializedProfile" here: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java#143
However, I cannot come up with a valid API-only scenario in which the profile is not null but the serialized profile is null. A minimal reproduction example would be nice for this ticket.

However, I briefly looked into the plugin code mentioned inside the crash report and found this: https://github.com/mfnalex/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/SkullUtils.java#L142

You, or the plugin you are using, is setting the profile field directly via reflrection, bypassing the setProfile method that usually ensures that the serializedProfile is updated accordingly. So by bypassing this method, the profile can en up non-null but the serializedProfile field is still null.

My current guess regarding why this "worked" before:
Maybe it is because the plugin actually set a profile that already contains texture data, and the new code now skips the texture loading if a texture is already present, which also skips the call to setProfile/setOwnerProfile and the second call to update the tag value, which might previously have "fixed" the inconsistent serializedProfile state.
But plugins bypassing the API is not really something the server implementation has to account for.

Comment by Epic Ebic [ 25/Oct/23 ]

Just tested on 3919 and it works as intended, no issues. Logs attached

Generated at Sat Dec 13 11:53:20 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.