NBT-API

NBT-API

98.9k Downloads

Cannot invoke "org.bukkit.inventory.ItemStack.hasItemMeta()" because "this.craftDelegate" is null

ssomar1607 opened this issue ยท 3 comments

commented

Here is the error : https://pastebin.com/BdsYzT5J

My code : id = NBT.get(item, UtilNBTAPI.getID);

public class UtilNBTAPI {

public static final Function<ReadableItemNBT, String> getID = (ReadableItemNBT nbt) -> {
    return nbt.getString("EI-ID");
};

}

Can you check why it appears pls.
Don't hesitate if you have questions.

Thank you,
Ssomar

commented

That looks like a broken item? The error is inside Paper. Do you perhaps extend ItemStack to try to create custom items or something like that?

commented

Ah yes I extend it, I should probably override the hasItemMeta and check

commented

Please note that extending the ItemStack class is not something you should do. When using it, it will randomly turn into a normal spigot ItemStack when used anywhere, losing all data etc. If you just want a better builder for your needs, make a builder class.