Package valorless.havenbags.items
Class BagItemFactory
java.lang.Object
valorless.havenbags.items.BagItemFactory
Factory for creating the in-inventory representation of a Haven Bag.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.inventory.ItemStackcreateBagItem(boolean binding, int size, org.bukkit.entity.Player player) Creates a new bag item with the specified properties.static org.bukkit.inventory.ItemStacktoItemStack(Data bag) Create an ItemStack representing the given bag data.
-
Constructor Details
-
BagItemFactory
public BagItemFactory()
-
-
Method Details
-
toItemStack
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 playersize- 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
-