Solved Placing a Skull block using 1.12.2 API

Discussion in 'Spigot Plugin Development' started by zeronerve, Jan 13, 2018.

  1. But the Skull class has setOwningPlayer(); It is a skull block not item.
  2. Oh, apologies. Misread the title.
  3. I've found the deprecated .setOwner(String playerName) method returns the player skull but .setOwningPlayer(OfflinePlayer) which accepts only an offline player returns a steve. I wonder if there's a way to get an offline player with non-deprecated methods. I'm glad it's working but SURELY there's a way. I don't want this to break next year.
  4. All good fan of your server. You wouldn't happen to know why setOwningPlayer(Bukkit.getOfflinePlayer(UUID.fromString("uuid"))) still shows a steve head after calling the skull.update?
  5. Thanks so much for you help guys.
  6. You may not want to use the setOwner("username") because the api says "Involves a potentially blocking web request to acquire the profile data for the provided name."
  7. Oh! Well I'll keep digging. I wonder if .setOwningPlayer only applies to a Block and not to the entended Skull meta info.

    [edit] the API does say .setOwningPlayer applies to the skull.
  8. Now that's what I like to hear ;)

    Only thing I can think of is that the player you're trying to use for the skin never joined the server. Try using one that did.

    That would allow you to always get the latest skin. Of course, you should do it asynchoniously as its IO and thus blocking, like the API says.
    • Like Like x 1
  9. Yes, I should have caught that. Good call. That worked.

    I'm new to this. So would this mean running this in a BukkitRunnable class using async?

    I'm getting off topic, so I'll post the code that worked for me.
  10. This worked for me (with no deprecated code)...

    Code (Text):
    Location originLocation = new Location(hub, originX, originY, originZ);
    Block originBlock = originLocation.getBlock();
    Skull skull = (Skull) originBlock.getState(); // make sure to import org.bukkit.block.Skull;
    • Like Like x 2
  11. You should be able to find plenty of examples online. If not, please create a new thread and tag me in it, ill help you out :p
    • Like Like x 1

Share This Page