Playerheads delayed skin

Discussion in 'Plugin Development' started by 567legodude, Apr 24, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    567legodude

    I created a playerhead and set the owner of it. The head works perfectly fine, nothing wrong with the code or anything, just that the skin of the head takes ages to load. Sometimes clicking the item will load it, and sometimes you just have to wait for it.
    Spawning a head from essentials loads the skin instantly, but looking at the source for essentials, they do not do anything different from what I do to spawn heads.
    Any idea why the skin takes forever to load, and any possible fixes?
    Note: Updating the players inventory does not help.
    I am making the item like this:
    Code:
    ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
    SkullMeta meta = (SkullMeta) head.getItemMeta();
    meta.setOwner(player.getName());
    head.setItemMeta(meta);
    Like I said the head works perfectly fine, but the skin takes forever to actually show up.
     
  2. Offline

    teej107

    @567legodude Try giving yourself a player's head with the /give command. See if the skin takes ages to load for that.
     
  3. Offline

    567legodude

    @teej107 Sometimes when I give the head to myself, it loads instantly, other times it just turns into alex and never loads. There are two commands I tried to give it to myself, both failed. (Usually load instantly) EDIT: These commands do load the head instantly. When placed in the inventory by my plugin it takes a long time. After a server restart the heads take about 5 seconds to load but it gets longer each time.
    Code:
    /give 567legodude head 1 3 Player:567legodude
    /i head:3 1 Player:567legodude
     
    Last edited: Apr 24, 2015
  4. Offline

    sgavster

    try player.updateInventory(); It might work, no promises.
     
  5. Offline

    567legodude

    @sgavster
     
  6. Offline

    LetsTalkTnTHere

    Its an mc 1.8 bug

    I think so though
     
  7. Offline

    567legodude

    @LetsTalkTnTHere I don't think its a bug, because I can make a head the exact same way as other plugins, but it will not work.
     
  8. Offline

    teej107

  9. Offline

    567legodude

    @teej107 @1Rogue Told me on the spigot forums: "Set it in a different thread, using Skull#setOwner will trigger a blocking web request if the skin isn't cached."
    I tried using a thread to do it, and it created the item, but the skin did not update any faster.
     
  10. Offline

    1Rogue

    It won't make it faster, it will just not lag your server.
     
Thread Status:
Not open for further replies.

Share This Page