[SPIGOT-3724] Changing SkullMeta for Player Skulls often does not work Created: 31/Dec/17  Updated: 01/Jan/18  Resolved: 01/Jan/18

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

Type: Bug Priority: Minor
Reporter: Erik Zeiger Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None

Attachments: PNG File 2017-12-31_13.46.13.png    

 Description   

I created a player head on login. I used SkullMeta.setOwningPlayer and got the "Alex" skin.

The deprecated setOwner gave the correct skin.



 Comments   
Comment by md_5 [ 01/Jan/18 ]

It's nothing to do with setOwningPlayer, it's a long sequence of bugs on both client and server.
Frankly stuff is so broken I'm surprised people haven't reported it before.
The only circumstance which I can actually see it working reliably is if you are 1) Running spigot, 2) Already have a tile entity with the correct skull, and 3) Use setOwner

Comment by Erik Zeiger [ 31/Dec/17 ]

I'm able to get your skull with that command in singleplayer and on the server, so I'm not sure what to add.

Comment by md_5 [ 31/Dec/17 ]

I cannot reproduce this.
I am not seeing any rate limiting in the client log either, but yet
/give @p minecraft:skull 1 3

{SkullOwner:md_5}

Will not give me my skull.

Nor will setOwner(name) in the plugin.
It seems very touchy, but I am unable to reproduce anything which points to an issue specifically with setOwningPlayer.

Comment by Erik Zeiger [ 31/Dec/17 ]

My issue is not with the rate limit. I wait around 2 minutes between restarts, and am able to get my head using setOwner(name) every time. setOwningPlayer always gives me the alex head.

Comment by md_5 [ 31/Dec/17 ]

Reproduced in single player with
/give @p minecraft:skull 1 3

{SkullOwner:md_5}

It also sometimes works in Spigot/CraftBukkit and sometimes doesn't.

It's Mojang's way too aggressive rate limiting on skins.
Wait some time and try again.

Comment by Erik Zeiger [ 31/Dec/17 ]

When I change it to setOwner(event.getPlayer().getName()), it updates to the right skin after a few seconds.

If you restart and rejoin too quick, you get rate limited and it won't work (as you'd expect).

Comment by md_5 [ 31/Dec/17 ]

I'm not seeing either method work in Spigot

Comment by Erik Zeiger [ 31/Dec/17 ]

Code:

@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
    ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
    
    SkullMeta meta = (SkullMeta)skull.getItemMeta();
    meta.setOwningPlayer(event.getPlayer());
    skull.setItemMeta(meta);
    
    event.getPlayer().getInventory().addItem(skull);
}

Picture of my skin and the skull I was given.

Comment by md_5 [ 31/Dec/17 ]

Useful reproduction code please

Generated at Tue Apr 15 11:10:33 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.