Class BagItemFactory

java.lang.Object
valorless.havenbags.items.BagItemFactory

public final class BagItemFactory extends Object
Factory for creating the in-inventory representation of a Haven Bag.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.inventory.ItemStack
    createBagItem(boolean binding, int size, org.bukkit.entity.Player player)
    Creates a new bag item with the specified properties.
    static org.bukkit.inventory.ItemStack
    Create an ItemStack representing the given bag data.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BagItemFactory

      public BagItemFactory()
  • Method Details

    • toItemStack

      public static org.bukkit.inventory.ItemStack toItemStack(@NotNull Data bag)
      Create an ItemStack representing the given bag data. - Uses Data.material if set; otherwise uses a player head with Data.texture if present; otherwise defaults to CHEST. - Applies name, custom model data, and a concise lore. - Stores identifying information in the PersistentDataContainer for later retrieval.
      Parameters:
      bag - Data instance
      Returns:
      ItemStack representing the bag
    • createBagItem

      public static org.bukkit.inventory.ItemStack createBagItem(boolean binding, int size, @Nullable org.bukkit.entity.Player player)
      Creates a new bag item with the specified properties. - If binding is true, the bag is considered bound to a player; otherwise it's ownerless. - The size determines the capacity and may affect the texture/model used. - Player parameter is used for placeholder parsing in lore and may influence texture/model selection if configured.
      Parameters:
      binding - Whether the bag should be bound to a player
      size - The size/capacity of the bag (e.g., 9, 18, 27, etc.)
      player - Optional player context for placeholder parsing placeholders.
      Returns:
      A new ItemStack representing the bag with the specified properties