Class ItemEnchant

java.lang.Object
net.pottercraft.ollivanders2.spell.O2Spell
net.pottercraft.ollivanders2.spell.ItemEnchant
Direct Known Subclasses:
CELATUM, FLAGRANTE, GEMINO, PORTUS, VOLATUS

public abstract class ItemEnchant extends O2Spell
Place an enchantment on an item.
  • Field Details

    • enchantmentType

      protected ItemEnchantmentType enchantmentType
      The type of enchantment
    • o2ItemTypeAllowList

      protected ArrayList<O2ItemType> o2ItemTypeAllowList
      The list of item types that this can enchant, if limited. When empty, all item types can be enchanted Cannot be mixed and match with o2ItemTypeAllowList (only use one or the other)
    • itemTypeAllowlist

      protected ArrayList<org.bukkit.Material> itemTypeAllowlist
      The list of item types that this can enchant, if limited. When empty, all item types can be enchanted. Cannot be mixed and match with o2ItemTypeAllowList (only use one or the other)
  • Constructor Details

    • ItemEnchant

      public ItemEnchant(Ollivanders2 plugin)
      Default constructor for use in generating spell text. Do not use to cast the spell.
      Parameters:
      plugin - the Ollivanders2 plugin
    • ItemEnchant

      public ItemEnchant(@NotNull @NotNull Ollivanders2 plugin, @NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull Double rightWand)
      Constructor.
      Parameters:
      plugin - a callback to the MC plugin
      player - the player who cast this spell
      rightWand - which wand the player was using
  • Method Details

    • checkEffect

      public void checkEffect()
      Override checkEffect to handle the enchantments that target an item in the player's inventory.
      Overrides:
      checkEffect in class O2Spell
    • enchantHeldItem

      protected void enchantHeldItem()
      Enchants the item held in the player's off-hand
    • doCheckEffect

      protected void doCheckEffect()
      Add the enchantment to an item stack in the projectile's location
      Specified by:
      doCheckEffect in class O2Spell
    • canBeEnchanted

      protected boolean canBeEnchanted(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      Can this item be enchanted by this spell?
      Parameters:
      itemStack - the item to check
      Returns:
      true if it can be enchanted, false otherwise
    • canBeEnchanted

      protected boolean canBeEnchanted(@NotNull @NotNull org.bukkit.entity.Item item)
      Can this item be enchanted by this spell?
      Parameters:
      item - the item to check
      Returns:
      true if it can be enchanted, false otherwise
    • initEnchantmentArgs

      protected void initEnchantmentArgs(org.bukkit.inventory.ItemStack itemStack)
      Set the enchantment arg string. This needs to be overridden by the classes that need it.
      Parameters:
      itemStack - the item being enchanted
    • alterItem

      @Nullable protected @Nullable org.bukkit.entity.Item alterItem(org.bukkit.entity.Item item)
      Do any after effects on the item. This needs to be overridden by the classes that need it.
      Parameters:
      item - the item to affect
      Returns:
      the altered item
    • alterItem

      protected org.bukkit.inventory.ItemStack alterItem(org.bukkit.inventory.ItemStack itemStack)
      Do any after effects on the item. This needs to be overridden by the classes that need it.
      Parameters:
      itemStack - the item to affect
      Returns:
      the altered item