Class NItem

java.lang.Object
beer.devs.fastnbt.nms.nbt.NCompound
beer.devs.fastnbt.nms.nbt.NItem

public class NItem extends NCompound
  • Constructor Details

    • NItem

      public NItem(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
  • Method Details

    • of

      @Nullable public static @Nullable NItem of(org.bukkit.inventory.ItemStack itemStack)
    • getItem

      public org.bukkit.inventory.ItemStack getItem()
    • setType

      public void setType(org.bukkit.Material type)
    • isConvertedCopy

      public boolean isConvertedCopy()
      Items in inventories and in the world are already implementing CraftItemStack NMS class. Other items created with Bukkit API and in some other cases do not implement CraftItemStack, so we have to use a temporary copy of the item and apply the changes later using save() method.
      Returns:
      true if this item wasn't originally a CraftItemStack, otherwise returns false.
    • save

      public void save()
      Applies changes to the original ItemStack if needed. It only saves changes if the original item isn't a CraftItemStack. Items in inventories and in the world are already implementing CraftItemStack NMS class. Other items created with Bukkit API and in some other cases do not implement CraftItemStack.
    • refreshCopy

      public void refreshCopy()
      Refreshes copy if needed. Only if it's a CraftItemStack copy.
    • hasNBT

      public static boolean hasNBT(org.bukkit.inventory.ItemStack itemStack)
    • merge

      public void merge(org.bukkit.inventory.ItemStack b)
    • merge

      public void merge(NItem b)
    • merge

      public boolean merge(String tag) throws com.google.gson.JsonSyntaxException
      Throws:
      com.google.gson.JsonSyntaxException
    • isValid

      public static boolean isValid(String component)
    • asCraftMirror

      public static org.bukkit.inventory.ItemStack asCraftMirror(org.bukkit.inventory.ItemStack itemStack)
    • compoundToBukkitItem

      @Nullable public static @Nullable org.bukkit.inventory.ItemStack compoundToBukkitItem(NCompound compound)
    • bukkitItemToNmsItem

      @Internal public static Object bukkitItemToNmsItem(org.bukkit.inventory.ItemStack itemStack)
    • nmsCompoundToBukkitItem

      @Internal public static org.bukkit.inventory.ItemStack nmsCompoundToBukkitItem(Object internalCompound)
    • bukkitItemToNmsCompound

      @Internal public static Object bukkitItemToNmsCompound(org.bukkit.inventory.ItemStack itemStack)
    • compoundStrToBukkitItem

      @Nullable public static @Nullable org.bukkit.inventory.ItemStack compoundStrToBukkitItem(String compoundString)
    • bukkitItemToCompoundStr

      public static String bukkitItemToCompoundStr(org.bukkit.inventory.ItemStack bukkitItem)
    • getCustomName

      public Object getCustomName()
    • getCustomNameJson

      public String getCustomNameJson()
    • setCustomName

      public void setCustomName(String compoundString)
    • getItemName

      public Object getItemName()
    • setItemName

      public void setItemName(String compoundString)
    • getLoreCopy

      @Nullable public @Nullable List<Object> getLoreCopy()
    • setLore

      public void setLore(@Nullable @Nullable List<?> lore)