Class O2Items
java.lang.Object
net.pottercraft.ollivanders2.item.O2Items
Manager for all items in Ollivanders
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe enchanted items manager - handles all enchantments on itemsstatic org.bukkit.NamespacedKeyNamespace key for NTB flags -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the names of all items.@Nullable org.bukkit.inventory.ItemStackgetItemByName(@NotNull String name, int amount) Get an item by name@Nullable org.bukkit.inventory.ItemStackgetItemByNameStartsWith(@NotNull String name, int amount) Get an item that name starts with a substring@Nullable org.bukkit.inventory.ItemStackgetItemByType(@NotNull O2ItemType itemType, int amount) Get an item by type@Nullable org.bukkit.MaterialgetItemMaterialByType(@NotNull O2ItemType itemType) Get the material type for an item type@Nullable StringgetItemNameByType(@NotNull O2ItemType itemType) Get the name of an item by type.@Nullable O2ItemTypegetItemTypeByItem(@NotNull org.bukkit.entity.Item item) Get the O2ItemType of an Item@Nullable O2ItemTypegetItemTypeByItemStack(@NotNull org.bukkit.inventory.ItemStack itemStack) Get the O2ItemType of an Item@Nullable O2ItemTypegetItemTypeByName(@NotNull String name) Get item type by display name - set in the metadata of the item@Nullable O2ItemTypegetItemTypeByNameStartsWith(@NotNull String name) Get an item where the name starts with this string@Nullable StringgetO2ItemNameFromItemStack(@NotNull org.bukkit.inventory.ItemStack itemStack) Get an O2Item name from the NBT o2ItemTypeKey tag in the item metadatagetWands()Get wands management classvoidCleanup when the plugin disables.voidonEnable()Load all items and enchantments
-
Field Details
-
enchantedItems
The enchanted items manager - handles all enchantments on items -
o2ItemTypeKey
public static org.bukkit.NamespacedKey o2ItemTypeKeyNamespace key for NTB flags
-
-
Constructor Details
-
O2Items
Constructor- Parameters:
plugin- a reference to the plugin
-
-
Method Details
-
onEnable
public void onEnable()Load all items and enchantments -
onDisable
public void onDisable()Cleanup when the plugin disables.Called when the Ollivanders2 plugin is being shut down. The O2Items manager performs no cleanup on disable because item data is read-only and loaded from configuration on startup. No persistent state needs to be saved.
-
getItemByType
@Nullable public @Nullable org.bukkit.inventory.ItemStack getItemByType(@NotNull @NotNull O2ItemType itemType, int amount) Get an item by type- Parameters:
itemType- the type of item to getamount- the amount of the item to get- Returns:
- an item stack of the item and amount, null if item not found
-
getItemByName
@Nullable public @Nullable org.bukkit.inventory.ItemStack getItemByName(@NotNull @NotNull String name, int amount) Get an item by name- Parameters:
name- the name of the itemamount- the amount of the item to get- Returns:
- an item stack of the item and amount, null if item not found
-
getItemByNameStartsWith
@Nullable public @Nullable org.bukkit.inventory.ItemStack getItemByNameStartsWith(@NotNull @NotNull String name, int amount) Get an item that name starts with a substring- Parameters:
name- the substring of the name starts withamount- the amount of the item to get- Returns:
- an item stack of the item and amount, null if item not found
-
getItemTypeByName
Get item type by display name - set in the metadata of the item- Parameters:
name- the display name for the item- Returns:
- the item type if found, null otherwise
-
getItemNameByType
Get the name of an item by type.- Parameters:
itemType- the item type- Returns:
- the name of this item or null if not found
-
getItemTypeByNameStartsWith
Get an item where the name starts with this string- Parameters:
name- the substring of the name starts with- Returns:
- the item type if found, null otherwise
-
getItemMaterialByType
@Nullable public @Nullable org.bukkit.Material getItemMaterialByType(@NotNull @NotNull O2ItemType itemType) Get the material type for an item type- Parameters:
itemType- the item type to get the material for- Returns:
- the material type if found, null otherwise
-
getO2ItemNameFromItemStack
@Nullable public @Nullable String getO2ItemNameFromItemStack(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Get an O2Item name from the NBT o2ItemTypeKey tag in the item metadata- Parameters:
itemStack- the item stack to check- Returns:
- the O2Item name if found, null otherwise
-
getAllItemNames
Get the names of all items.- Returns:
- an array of the item names
-
getItemTypeByItem
@Nullable public @Nullable O2ItemType getItemTypeByItem(@NotNull @NotNull org.bukkit.entity.Item item) Get the O2ItemType of an Item- Parameters:
item- the item to check- Returns:
- the O2ItemType if it is an O2Item, null otherwise
-
getItemTypeByItemStack
@Nullable public @Nullable O2ItemType getItemTypeByItemStack(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Get the O2ItemType of an Item- Parameters:
itemStack- the ItemStack to check- Returns:
- the O2ItemType if it is an O2Item, null otherwise
-
getWands
Get wands management class- Returns:
- wands
-