Class ItemsAdder

java.lang.Object
dev.lone.itemsadder.api.ItemsAdder

public class ItemsAdder extends Object
API entry point for ItemsAdder.

Most methods in this class are deprecated in favor of the dedicated wrapper classes such as CustomStack, CustomBlock, CustomFurniture, and CustomEntity.

  • Constructor Details

    • ItemsAdder

      public ItemsAdder()
  • Method Details

    • areItemsLoaded

      @Deprecated public static boolean areItemsLoaded()
      Deprecated.
      use load events and dedicated registry methods instead.
      Checks if ItemsAdder items are loaded.
      Returns:
      true if items are loaded.
    • isCustomItem

      @Deprecated public static boolean isCustomItem(ItemStack itemStack)
      Deprecated.
      Checks if an item stack is an ItemsAdder custom item.
      Parameters:
      itemStack - the item stack to check.
      Returns:
      true if the item is custom.
    • isCustomItem

      @Deprecated public static boolean isCustomItem(String customItemName)
      Deprecated.
      Checks if a custom item is registered.
      Parameters:
      customItemName - the custom item namespaced id.
      Returns:
      true if the item is registered.
    • getCustomItem

      @Deprecated public static ItemStack getCustomItem(String namespacedId)
      Deprecated.
      Gets a custom item stack copy.
      Parameters:
      namespacedId - the custom item namespaced id.
      Returns:
      the custom item stack.
    • placeCustomBlock

      @Deprecated public static void placeCustomBlock(Location location, ItemStack itemStack)
      Deprecated.
      Places a custom block from an item stack.
      Parameters:
      location - the target location.
      itemStack - the custom block item stack.
    • removeCustomBlock

      @Deprecated public static void removeCustomBlock(Location location)
      Deprecated.
      Removes a custom block at a location.
      Parameters:
      location - the custom block location.
    • getCustomBlockByFaces

      @Deprecated public static ItemStack getCustomBlockByFaces(Material material, HashMap<BlockFace, Boolean> blockFaces)
      Deprecated.
      use dedicated custom block APIs instead.
      Gets a custom block item by its base material and facing data.
      Parameters:
      material - the base material.
      blockFaces - the facing data.
      Returns:
      the custom block item stack.
    • isCustomBlock

      @Deprecated public static boolean isCustomBlock(Block block)
      Deprecated.
      Checks if a block is an ItemsAdder custom block.
      Parameters:
      block - the block to check.
      Returns:
      true if the block is custom.
    • getCustomBlockLoot

      @Deprecated public static List<ItemStack> getCustomBlockLoot(Block block, boolean includeSelfBlock)
      Gets loot generated by a custom block.
      Parameters:
      block - the custom block.
      includeSelfBlock - true to include the custom block item itself.
      Returns:
      the generated loot.
    • getCustomBlockLoot

      @Deprecated public static List<ItemStack> getCustomBlockLoot(Block block)
      Gets loot generated by a custom block.
      Parameters:
      block - the custom block.
      Returns:
      the generated loot.
    • getCustomBlockLoot

      @Deprecated public static List<ItemStack> getCustomBlockLoot(Block block, ItemStack tool, boolean includeSelfBlock)
      Gets loot generated by a custom block.
      Parameters:
      block - the custom block.
      tool - the tool used to break the block.
      includeSelfBlock - true to include the custom block item itself.
      Returns:
      the generated loot.
    • placeCustomCrop

      @Deprecated public static void placeCustomCrop(Location location, ItemStack seed)
      Deprecated.
      Places a custom crop from a seed item stack.
      Parameters:
      location - the target location.
      seed - the seed item stack.
    • isCustomCrop

      @Deprecated public static boolean isCustomCrop(Block block)
      Deprecated.
      Checks if a block is an ItemsAdder custom crop.
      Parameters:
      block - the block to check.
      Returns:
      true if the block is a custom crop.
    • getCustomSeedNameFromCrop

      @Deprecated public static String getCustomSeedNameFromCrop(Block block)
      Gets the seed namespaced id associated with a custom crop block.
      Parameters:
      block - the crop block.
      Returns:
      the seed namespaced id.
    • getCustomBlock

      @Deprecated @Nullable public static @Nullable ItemStack getCustomBlock(Block block)
      Deprecated.
      Gets the custom block item for an already placed block.
      Parameters:
      block - the block to check.
      Returns:
      the custom block item stack, null if the custom block was removed from config, or a vanilla item for non-custom blocks.
    • matchCustomItemName

      @Deprecated public static boolean matchCustomItemName(ItemStack itemStack, String customItemName)
      Checks if an item stack matches a custom item namespaced id.
      Parameters:
      itemStack - the item stack to check.
      customItemName - the custom item namespaced id.
      Returns:
      true if the item matches.
    • isFurniture

      @Deprecated public static boolean isFurniture(Entity entity)
      Checks if an entity is simple furniture.
      Parameters:
      entity - the entity to check.
      Returns:
      true if the entity is furniture.
    • getCustomItemName

      @Deprecated public static String getCustomItemName(ItemStack itemStack)
      Gets the custom item namespaced id stored on an item stack.
      Parameters:
      itemStack - the item stack.
      Returns:
      the custom item namespaced id.
    • getCustomItemUsages

      @Deprecated public static int getCustomItemUsages(ItemStack itemStack)
      Gets the usages stored on a custom item stack.
      Parameters:
      itemStack - the item stack.
      Returns:
      the usages value, or 0 if not present.
    • setCustomItemDurability

      @Deprecated public static ItemStack setCustomItemDurability(ItemStack item, int durability)
      Deprecated.
      Sets custom durability on an item stack.
      Parameters:
      item - the item stack.
      durability - the new durability.
      Returns:
      the same item stack.
    • setCustomItemMaxDurability

      @Deprecated public static ItemStack setCustomItemMaxDurability(ItemStack item, int maxDurability)
      Deprecated.
      Sets maximum custom durability on an item stack.
      Parameters:
      item - the item stack.
      maxDurability - the new maximum durability.
      Returns:
      the same item stack.
    • getCustomItemDurability

      @Deprecated public static int getCustomItemDurability(ItemStack itemStack)
      Deprecated.
      Gets custom durability from an item stack.
      Parameters:
      itemStack - the item stack.
      Returns:
      the durability value.
    • getCustomItemMaxDurability

      @Deprecated public static int getCustomItemMaxDurability(ItemStack itemStack)
      Deprecated.
      Gets maximum custom durability from an item stack.
      Parameters:
      itemStack - the item stack.
      Returns:
      the maximum durability value.
    • getNamespacedBlocksNamesInConfig

      @Deprecated public static List<String> getNamespacedBlocksNamesInConfig(String searchStr)
      Searches registered custom block namespaced ids.
      Parameters:
      searchStr - the search string, or null.
      Returns:
      matching custom block namespaced ids.
    • getNamespacedBlocksNamesInConfig

      @Deprecated public static List<String> getNamespacedBlocksNamesInConfig()
      Gets all registered custom block namespaced ids.
      Returns:
      custom block namespaced ids.
    • getCustomBlockBlockData

      @Deprecated public static BlockData getCustomBlockBlockData(ItemStack customBlock, boolean lightweight)
      Deprecated.
      Gets the block data used by a custom block item stack.
      Parameters:
      customBlock - the custom block item stack.
      lightweight - currently unused.
      Returns:
      the block data, or null if not supported.
    • playTotemAnimation

      public static boolean playTotemAnimation(Player player, String namespacedId)
      Play totem animation. Warning: make sure to delay it using a bukkit runnable (1 tick should be ok) if you call this after you close an inventory or sometimes animation won't show.

      Returns true if successful, returns false if the totem namespacedid is not valid.

      Parameters:
      player - the player that will see the animation.
      namespacedId - the custom totem namespaced id.
      Returns:
      true if the animation was sent.
    • setLiquid

      @Deprecated public static void setLiquid(String namespacedID, Location location)
      Deprecated.
      custom liquid APIs are deprecated.
      Places a custom liquid at a location.
      Parameters:
      namespacedID - the liquid namespaced id.
      location - the target location.
    • getLiquidName

      @Deprecated @Nullable public static @Nullable String getLiquidName(Location location)
      Deprecated.
      custom liquid APIs are deprecated.
      Gets the custom liquid namespaced id at a location.
      Parameters:
      location - the location to check.
      Returns:
      the liquid namespaced id, or null if no custom liquid is stored there.
    • hasKeepOnDeath

      public static boolean hasKeepOnDeath(ItemStack itemStack)
      Checks if an item stack has the keep-on-death behaviour.
      Parameters:
      itemStack - the item stack to check.
      Returns:
      true if the item has keep-on-death behaviour.
    • hasKeepOnDeath

      public static boolean hasKeepOnDeath(String namespacedId)
      Checks if a registered item has the keep-on-death behaviour.
      Parameters:
      namespacedId - the custom item namespaced id.
      Returns:
      true if the item has keep-on-death behaviour.
    • applyResourcepack

      public static void applyResourcepack(Player player)
      Sends the configured resource pack to a player.
      Parameters:
      player - the player.
    • getAllItems

      public static List<CustomStack> getAllItems()
      Returns all the registered items.
      Returns:
      null if ItemsAdder is not loaded completely, be sure to listen to ItemsAdderFirstLoadEvent
    • getAllItems

      public static List<CustomStack> getAllItems(String namespace)
      Returns all the registered items by a specific namespace.
      Returns:
      null if ItemsAdder is not loaded completely, be sure to listen to ItemsAdderFirstLoadEvent
    • getAllItems

      public static List<CustomStack> getAllItems(Material material)
      Returns all the registered items which use a specific Bukkit Material.
      Returns:
      null if ItemsAdder is not loaded completely, be sure to listen to ItemsAdderFirstLoadEvent
    • isCustomRecipe

      public static boolean isCustomRecipe(NamespacedKey namespacedKey)
      Checks if a recipe is registered by ItemsAdder.
      Parameters:
      namespacedKey - the recipe key.
      Returns:
      true if the recipe is a custom ItemsAdder recipe.
    • isCustomRecipe

      public static boolean isCustomRecipe(String namespacedId)
      Checks if a recipe is registered by ItemsAdder.
      Parameters:
      namespacedId - the recipe namespaced id.
      Returns:
      true if the recipe is a custom ItemsAdder recipe.
    • getPackUrl

      @Nullable public static @Nullable String getPackUrl(boolean appendHash)
      Gets the configured resource pack URL.
      Parameters:
      appendHash - currently unused.
      Returns:
      the pack URL, or null if it is not available.