Hey guys, so I'm building a gui with the player's skull in it and I realized that everytime I opened the gui the console would say something like "Initiliazing legacy support" and that's not really what I want so I did some debug and found out that my method to set the skull owner turns the itemstack into a Legacy itemstack?? Here's my method: Code (Java): SkullMeta im = (SkullMeta) is.getItemMeta(); assert im != null; im.setOwner(owner); is.setItemMeta(im); Any help would be appreciated I don't want to use Legacy materials.
To use a skull, you have to set the damage always to 3 (idk why). Like this: Code (Java): ItemStack is = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
No you don’t. You can start by using https://hub.spigotmc.org/javadocs/b...tml#setOwningPlayer-org.bukkit.OfflinePlayer- instead. Don’t use assertions in your code if you aren’t going to use -ea when running the server.
The assert is because intellij is bugging me lol I don’t know what -ea does. Also, I don’t even use the getOfflinePlayer() method, I just pass the player directly as the parameter.
@xTrollxDudex suggested using the #setOwningPlayer method that is the updated version of #setOwner. setOwner takes in a String, rather than a Player object. So your code wouldn't work as, assuming you're not getting any errors, it is setting the owner to [email protected] rather than setting it to the proper player. setOwningPlayer takes in an OfflinePlayer which also accepts Player as Player is an extension/implementation of OfflinePlayer.
[Server thread/WARN]: Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug! Still not working Code (Java): try { SkullMeta im = (SkullMeta) is.getItemMeta(); assert im != null; im.setOwningPlayer(owner); is.setItemMeta(im); } catch (ClassCastException ignored) { }