Closed Creuch closed 1 year ago
Can I see the strings? Also the skullTexture is overriding skullOwner, or am I missing something? They're used on the same item meta. Or maybe you're using them as an alias.
Can I see the strings? skullOwner =
_Creuch
skullTexture =eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDdhY2ZmNThjMjExZTQ2ODA2ZDRhYzlhNzczMjBiZjU3MjUwZWQ4YmY3OTMzZWE0M2FjOGVmMmZkNzBkZWZkYyJ9fX0=
Also the skullTexture is overriding skullOwner, or am I missing something? They're used on the same item meta. Or maybe you're using them as an alias. It is, if both are set. If a user wants only skullOwner, then they aren't setting userTexture, so it's null
It's working fine for me
fun giveSkull(sync: Boolean, value: String, prevSync: Boolean = sync) {
if (!sync) {
Bukkit.getScheduler().runTaskAsynchronously(plugin) { -> giveSkull(true, value, false) }
return
}
val item = XMaterial.PLAYER_HEAD.parseItem()!!
var meta = item.itemMeta as SkullMeta
meta = SkullUtils.applySkin(meta, value)
meta.setDisplayName("$prevSync|${Bukkit.isPrimaryThread()} $value")
item.itemMeta = meta
player.inventory.addItem(item)
}
giveSkull(true, "_Creuch")
giveSkull(true, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDdhY2ZmNThjMjExZTQ2ODA2ZDRhYzlhNzczMjBiZjU3MjUwZWQ4YmY3OTMzZWE0M2FjOGVmMmZkNzBkZWZkYyJ9fX0=")
giveSkull(false, "_Creuch")
giveSkull(false, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDdhY2ZmNThjMjExZTQ2ODA2ZDRhYzlhNzczMjBiZjU3MjUwZWQ4YmY3OTMzZWE0M2FjOGVmMmZkNzBkZWZkYyJ9fX0=")
But I must say that the result for _Creuch
is not correctly displayed sync and async inside the inventory. It's displayed correctly when placed. I tested this with Essentials /skull
too which means whatever it is, it's not a SkullUtils bug.
Now it is for me too, idk why :/
public ItemStack asSkull(ItemStack[] is, String owner, boolean async) {
if(async) Bukkit.getScheduler().runTaskAsynchronously(instance, () -> is[0] = asSkull(is, owner, false));
SkullMeta sm = (SkullMeta) is[0].getItemMeta();
sm = SkullUtils.applySkin(sm, owner);
is[0].setItemMeta(sm);
return is[0];
}
Anyway, thanks for the help
Description I'm trying to make a inventory with custom heads. Everything is working fine, until I make SkullUtils methods async, to don't lag the server. Then the skulls are never set to anything and always are Steve's
Working fine:
Doesn't work:
Version git-Paper-307 (MC: 1.19.2)