Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by zeronerve, Jan 13, 2018.
But the Skull class has setOwningPlayer(); It is a skull block not item.
Oh, apologies. Misread the title.
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.
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?
Thanks so much for you help guys.
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."
Oh! Well I'll keep digging. I wonder if .setOwningPlayer only applies to a Block and not to the entended Skull meta info.
 the API does say .setOwningPlayer applies to the skull.
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.
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.
This worked for me (with no deprecated code)...
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;
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