Changing SkullMeta for Player Skulls often does not work

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None

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

      The deprecated setOwner gave the correct skin.

          [SPIGOT-3724] Changing SkullMeta for Player Skulls often does not work

          md_5 added a comment -

          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

          md_5 added a comment - 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

          Erik Zeiger added a comment -

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

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

          md_5 added a comment -

          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.

          md_5 added a comment - 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.

          Erik Zeiger added a comment -

          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.

          Erik Zeiger added a comment - 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.

          md_5 added a comment -

          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.

          md_5 added a comment - 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.

          Erik Zeiger added a comment - - edited

          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).

          Erik Zeiger added a comment - - edited 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).

          md_5 added a comment -

          I'm not seeing either method work in Spigot

          md_5 added a comment - I'm not seeing either method work in Spigot

          Erik Zeiger added a comment -

          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.

          Erik Zeiger added a comment - 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.

          md_5 added a comment -

          Useful reproduction code please

          md_5 added a comment - Useful reproduction code please

            Assignee:
            Unassigned
            Reporter:
            Erik Zeiger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: