Skip to content

Fix PlayerProfile applySkinToPlayerHeadContents#13692

Open
MrKinau wants to merge 1 commit intoPaperMC:mainfrom
MrKinau:fix/playerprofile-applyskintoplayerheadcontents
Open

Fix PlayerProfile applySkinToPlayerHeadContents#13692
MrKinau wants to merge 1 commit intoPaperMC:mainfrom
MrKinau:fix/playerprofile-applyskintoplayerheadcontents

Conversation

@MrKinau
Copy link

@MrKinau MrKinau commented Mar 10, 2026

Since #13585 Player and OfflinePlayer correctly set their full profile as SkinSource. When using a profile without texture properties, but with a name AND an id the current behavior sets both even when no properties are set, which results in the displayed player head being rendered as a default skin. I suggest that in the case that no properties are present the client should fetch the profile, which is only possible when id OR name are set (not both).

This fixes the displayed skin head of offline players (letting the client fetch the profile) as OfflinePlayers have no skin data stored.

OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(UUID.fromString("25081653-ae35-4316-b723-7cb435fc7892"));
Component head = Component.object(ObjectContents.playerHead(offlinePlayer));
player.sendMessage(head);

^ currently displays some default skin, but with this PR let's the client fetch the profile and displays the correct skin

Theoretically the current code could work, but only if either name or id is null, however this is not the case for offline players, dunno if this is another bug or intentional, but the PlayerProfiles of OfflinePlayers have an empty (not null, but empty) string as name (when get by UUID, when get by name they have their correct name) and a uuid. Thats weird as the org.bukkit.craftbukkit.profile.CraftPlayerProfile (imo) correctly checks if the name is empty and returns null instead, but if this is not intended the correct fix would prob. be to set the name instead of letting it return null instead of an empty string.

I only changed the behavior of PlayerProfile#applySkinToPlayerHeadContents to fix this issue and did not change the empty string name. The only behavior change is noticeable when having id AND name set and no properties (in that case it prefers the uuid and ignores the name to let the client fetch the profile).

@MrKinau MrKinau requested a review from a team as a code owner March 10, 2026 02:12
@github-project-automation github-project-automation bot moved this to Awaiting review in Paper PR Queue Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Awaiting review

Development

Successfully merging this pull request may close these issues.

1 participant