java.lang.Object
net.pottercraft.ollivanders2.item.wand.O2Wands

public class O2Wands extends Object
Manage wands and wand functions
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Wand conjunction for wand lore
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    checkCoreNBT(@NotNull String core, @NotNull org.bukkit.inventory.ItemStack itemStack)
    Does this core match what is set on the NBT for this wand?
    boolean
    checkNBT(@NotNull org.bukkit.inventory.ItemStack itemstack)
    Check wand NBT
    boolean
    checkWoodNBT(@NotNull String wood, @NotNull org.bukkit.inventory.ItemStack itemStack)
    Does this wood match what is set on the NBT for this wand?
    @Nullable org.bukkit.inventory.ItemStack
    createCorelessWand(@NotNull O2WandWoodType woodType, int amount)
    Create a coreless wand of a specified wood type.
    @NotNull String
    createLore(@NotNull String wood, @NotNull String core)
    Make a wand lore string from a wood and core
    @Nullable org.bukkit.inventory.ItemStack
    Create a random wand
    @NotNull List<org.bukkit.inventory.ItemStack>
    Get all the wands in the game.
    boolean
    giveRandomWand(@NotNull org.bukkit.entity.Player player)
    Give a player a random wand.
    boolean
    holdsWand(@NotNull org.bukkit.entity.Player player)
    Does the player hold a wand item in their primary hand?
    boolean
    holdsWand(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.EquipmentSlot hand)
    Does the player hold a wand item in their hand?
    boolean
    isDestinedWand(@NotNull O2Player player, @NotNull org.bukkit.inventory.ItemStack itemStack)
    Determine if a wand matches the player's destined wand type.
    boolean
    isDestinedWand(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.ItemStack stack)
    Is this ItemStack the player's destined wand?
    boolean
    isWand(@NotNull org.bukkit.inventory.ItemStack itemstack)
    Is this item stack a wand?
    @Nullable org.bukkit.inventory.ItemStack
    makeWand(@NotNull String wood, @NotNull String core, int amount)
    Make an ItemStack of a specific wand type
    @Nullable org.bukkit.inventory.ItemStack
    makeWandFromCoreless(@NotNull org.bukkit.inventory.ItemStack corelessWand, @NotNull O2WandCoreType core, int amount)
    Make a wand from a coreless wand and a wand core

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • O2Wands

      public O2Wands(Ollivanders2 plugin)
      Constructor
      Parameters:
      plugin - callback to the plugin
  • Method Details

    • isWand

      public boolean isWand(@NotNull @NotNull org.bukkit.inventory.ItemStack itemstack)
      Is this item stack a wand?
      Parameters:
      itemstack - stack to be checked
      Returns:
      true if yes, false if no
    • checkNBT

      public boolean checkNBT(@NotNull @NotNull org.bukkit.inventory.ItemStack itemstack)
      Check wand NBT
      Parameters:
      itemstack - the itemstack to check
      Returns:
      true if this wand has a valid NBT, false otherwise
    • createLore

      @NotNull public @NotNull String createLore(@NotNull @NotNull String wood, @NotNull @NotNull String core)
      Make a wand lore string from a wood and core
      Parameters:
      wood - the wand wood type
      core - the wand core type
      Returns:
      the wand lore string
    • isDestinedWand

      public boolean isDestinedWand(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.inventory.ItemStack stack)
      Is this ItemStack the player's destined wand?
      Parameters:
      player - player to check the stack against.
      stack - ItemStack to be checked
      Returns:
      true if yes, false if no
    • isDestinedWand

      public boolean isDestinedWand(@NotNull @NotNull O2Player player, @NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      Determine if a wand matches the player's destined wand type.
      Parameters:
      player - the player to check
      itemStack - the wand to check
      Returns:
      true if is a wand and matches the player's destined wand, false otherwise
    • checkCoreNBT

      public boolean checkCoreNBT(@NotNull @NotNull String core, @NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      Does this core match what is set on the NBT for this wand?
      Parameters:
      core - the core type
      itemStack - the item to check
      Returns:
      true if it matches, false otherwise
    • checkWoodNBT

      public boolean checkWoodNBT(@NotNull @NotNull String wood, @NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      Does this wood match what is set on the NBT for this wand?
      Parameters:
      wood - the wood type
      itemStack - the item to check
      Returns:
      true if it matches, false otherwise
    • holdsWand

      public boolean holdsWand(@NotNull @NotNull org.bukkit.entity.Player player)
      Does the player hold a wand item in their primary hand?
      Parameters:
      player - player to check.
      Returns:
      true if the player holds a wand, false otherwise
    • holdsWand

      public boolean holdsWand(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.inventory.EquipmentSlot hand)
      Does the player hold a wand item in their hand?
      Parameters:
      player - player to check.
      hand - the equipment slot to check for this player
      Returns:
      true if the player holds a wand, false otherwise
    • getAllWands

      @NotNull public @NotNull List<org.bukkit.inventory.ItemStack> getAllWands()
      Get all the wands in the game.
      Returns:
      a list of all the wands
    • makeWand

      @Nullable public @Nullable org.bukkit.inventory.ItemStack makeWand(@NotNull @NotNull String wood, @NotNull @NotNull String core, int amount)
      Make an ItemStack of a specific wand type
      Parameters:
      wood - the wand wood
      core - the wand core
      amount - the number of wands to make
      Returns:
      an ItemStack of wands or null if wood or core is not valid
    • makeWandFromCoreless

      @Nullable public @Nullable org.bukkit.inventory.ItemStack makeWandFromCoreless(@NotNull @NotNull org.bukkit.inventory.ItemStack corelessWand, @NotNull @NotNull O2WandCoreType core, int amount)
      Make a wand from a coreless wand and a wand core
      Parameters:
      corelessWand - the coreless wand
      core - the wand core
      amount - the amount to make
      Returns:
      an item stack of the wand type, null if an error occurred
    • createCorelessWand

      @Nullable public @Nullable org.bukkit.inventory.ItemStack createCorelessWand(@NotNull @NotNull O2WandWoodType woodType, int amount)
      Create a coreless wand of a specified wood type.
      Parameters:
      woodType - the wood type for the wand
      amount - the amount
      Returns:
      an item stack of this wand type, null if an error occurred
    • giveRandomWand

      public boolean giveRandomWand(@NotNull @NotNull org.bukkit.entity.Player player)
      Give a player a random wand.
      Parameters:
      player - the player to give the wand to
      Returns:
      true if successful
    • createRandomWand

      @Nullable public @Nullable org.bukkit.inventory.ItemStack createRandomWand()
      Create a random wand
      Returns:
      a random wand or null if something went wrong