java.lang.Object
net.pottercraft.ollivanders2.item.enchantment.Enchantment
net.pottercraft.ollivanders2.item.enchantment.VOLATUS

public class VOLATUS extends Enchantment
VOLATUS flight enchantment for broomsticks.

VOLATUS is an expert-level beneficial enchantment that grants the O2EffectType.BROOM_FLYING effect to players holding volatus-enchanted broomsticks. The enchantment actively monitors whether the player is holding a volatus item and applies or removes the flying effect accordingly. Flight is only enabled when the player has a volatus-enchanted broomstick in their main hand or off-hand.

Enchantment behavior:

  • When a volatus item is picked up, the flying effect is applied if the player is now holding one
  • When a volatus item is dropped, the flying effect is removed if the player is no longer holding one
  • When the player switches hotbar slots, flying status is re-evaluated based on current item
  • Hoppers cannot pick up volatus items (broomsticks persist in the world)
  • Requires broomsticks to be enabled in the plugin configuration
See Also:
  • Constructor Details

    • VOLATUS

      public VOLATUS(@NotNull @NotNull Ollivanders2 plugin, int mag, @Nullable @Nullable String args, @Nullable @Nullable String itemLore)
      Constructor for creating a VOLATUS flight enchantment instance.
      Parameters:
      plugin - the Ollivanders2 plugin instance
      mag - the magnitude (power level) of this enchantment
      args - optional configuration arguments specific to this enchantment instance
      itemLore - optional custom lore to display on the enchanted broomstick
  • Method Details

    • doEntityPickupItem

      public void doEntityPickupItem(@NotNull @NotNull org.bukkit.event.entity.EntityPickupItemEvent event)
      Handle player pickup of a volatus-enchanted item (broomstick).

      When a player picks up an item, this method schedules a deferred check to see if they're now holding a volatus-enchanted broomstick. If so, the O2EffectType.BROOM_FLYING effect is applied via checkBroomStatus(Player).

      The check is scheduled with a 1-second (20-tick) delay to allow the inventory update to complete before evaluating the player's current items. Does nothing if the entity picking up the item is not a player, or if broomsticks are disabled in the configuration.

      Specified by:
      doEntityPickupItem in class Enchantment
      Parameters:
      event - the entity item pickup event
    • doInventoryPickupItem

      public void doInventoryPickupItem(@NotNull @NotNull org.bukkit.event.inventory.InventoryPickupItemEvent event)
      Prevent hoppers and block inventories from picking up volatus-enchanted items.

      Volatus items (broomsticks) cannot be picked up by hoppers or other automated inventory systems. This prevents broomsticks from being moved into storage systems and ensures they remain available for players to find and use as intended.

      Specified by:
      doInventoryPickupItem in class Enchantment
      Parameters:
      event - the inventory pickup item event (not used, but required by interface)
    • doItemDrop

      public void doItemDrop(@NotNull @NotNull org.bukkit.event.player.PlayerDropItemEvent event)
      Re-evaluate flying status when a player drops an item.

      When a player drops an item, this method schedules a deferred check to see if they're still holding a volatus-enchanted broomstick. If they no longer have a volatus item in either hand, the O2EffectType.BROOM_FLYING effect is removed.

      The check is scheduled with a 1-second (20-tick) delay to allow the inventory update to complete before evaluating the player's current items. Does nothing if broomsticks are disabled in the configuration.

      Specified by:
      doItemDrop in class Enchantment
      Parameters:
      event - the player drop item event
    • doItemHeld

      public void doItemHeld(@NotNull @NotNull org.bukkit.event.player.PlayerItemHeldEvent event)
      Re-evaluate flying status when a player changes which item slot is held.

      When a player switches between hotbar slots, this method schedules a deferred check to see if they're now holding a volatus-enchanted broomstick. If they are, the O2EffectType.BROOM_FLYING effect is applied; otherwise it is removed.

      The check is scheduled with a 1-second (20-tick) delay to allow the slot change to complete before evaluating what item is now in the player's hand. Does nothing if broomsticks are disabled in the configuration.

      Specified by:
      doItemHeld in class Enchantment
      Parameters:
      event - the player item held event (slot switching event)