[SPIGOT-2544] hasOwner() on Skull doesn't properly check if the skull belongs to a valid player Created: 22/Jul/16  Updated: 22/Jul/16  Resolved: 22/Jul/16

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

Type: Bug Priority: Minor
Reporter: zombachu Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: skull, uuid


 Description   

Currently, hasOwner() only checks if the profile field is null, and not whether the UUID of the GameProfile is null. This runs into the issue that calling hasOwner() isn't a sufficient enough check for trying to get the OfflinePlayer object representing the skull's owner with getOwningPlayer().



 Comments   
Comment by zombachu [ 22/Jul/16 ]

@md_5

To your first comment, a skull that's created with an invalid skull owner name (like with /minecraft:give @p minecraft:skull 1 3

{SkullOwner:19udfij23sadi}

) will create a GameProfile, but won't give it an UUID.

Thanks for the quick fix, though. I think it's working properly now. Before, with the edge case mentioned above, just calling getOwningPlayer would throw an IllegalArgumentException.

Comment by md_5 [ 22/Jul/16 ]

I've made getOwningPlayer more robust, but hasOwner is still working as intended.

Comment by md_5 [ 22/Jul/16 ]

hasOwner corresponds to getOwner which does not rely on UUID.
Additionally I am not aware of a situation in which such a skull may be created.

Generated at Thu Apr 03 16:47:53 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.