Class VOLATUS
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:
-
Field Summary
Fields inherited from class net.pottercraft.ollivanders2.item.enchantment.Enchantment
args, common, enchantmentType, lore, magnitude, p -
Constructor Summary
ConstructorsConstructorDescriptionVOLATUS(@NotNull Ollivanders2 plugin, int mag, @Nullable String args, @Nullable String itemLore) Constructor for creating a VOLATUS flight enchantment instance. -
Method Summary
Modifier and TypeMethodDescriptionvoiddoEntityPickupItem(@NotNull org.bukkit.event.entity.EntityPickupItemEvent event) Handle player pickup of a volatus-enchanted item (broomstick).voiddoInventoryPickupItem(@NotNull org.bukkit.event.inventory.InventoryPickupItemEvent event) Prevent hoppers and block inventories from picking up volatus-enchanted items.voiddoItemDrop(@NotNull org.bukkit.event.player.PlayerDropItemEvent event) Re-evaluate flying status when a player drops an item.voiddoItemHeld(@NotNull org.bukkit.event.player.PlayerItemHeldEvent event) Re-evaluate flying status when a player changes which item slot is held.Methods inherited from class net.pottercraft.ollivanders2.item.enchantment.Enchantment
doItemDespawn, getArgs, getMagnitude, getName, getType, isHoldingEnchantedItem
-
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 instancemag- the magnitude (power level) of this enchantmentargs- optional configuration arguments specific to this enchantment instanceitemLore- 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_FLYINGeffect is applied viacheckBroomStatus(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:
doEntityPickupItemin classEnchantment- 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:
doInventoryPickupItemin classEnchantment- 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_FLYINGeffect 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:
doItemDropin classEnchantment- 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_FLYINGeffect 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:
doItemHeldin classEnchantment- Parameters:
event- the player item held event (slot switching event)
-