Class TickEvent

java.lang.Object
org.bukkit.event.Event
io.artificial.enchantments.api.event.EnchantEffectEvent
io.artificial.enchantments.api.event.TickEvent

public class TickEvent extends EnchantEffectEvent
Event fired periodically when an enchanted item is held or worn as armor.

Carries data about the player, item, slot, and consecutive scan counters during periodic tick events. This event is not cancellable.

Since:
0.1.0
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • Constructor Summary

    Constructors
    Constructor
    Description
    TickEvent(@NotNull EnchantmentDefinition enchantment, int level, double scaledValue, @NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.ItemStack item, @NotNull org.bukkit.inventory.EquipmentSlot slot, boolean isHeld, boolean isArmor, int tickCount, long heldDuration)
    Creates a new TickEvent.
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull org.bukkit.event.HandlerList
    Gets the handler list for this event type.
    @NotNull org.bukkit.event.HandlerList
     
    long
    Gets the duration the item has been held in ticks.
    @NotNull org.bukkit.inventory.ItemStack
    Gets the enchanted item.
    @NotNull org.bukkit.entity.Player
    Gets the player holding or wearing the item.
    @NotNull org.bukkit.inventory.EquipmentSlot
    Gets the equipment slot.
    int
    Gets the tick counter.
    boolean
    Checks if the item is worn as armor.
    boolean
    Checks if the item is being held in hand.

    Methods inherited from class io.artificial.enchantments.api.event.EnchantEffectEvent

    checkCancelled, getEnchantment, getLevel, getScaledValue, isCancellable

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

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

    • TickEvent

      public TickEvent(@NotNull @NotNull EnchantmentDefinition enchantment, int level, double scaledValue, @NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.inventory.ItemStack item, @NotNull @NotNull org.bukkit.inventory.EquipmentSlot slot, boolean isHeld, boolean isArmor, int tickCount, long heldDuration)
      Creates a new TickEvent.
      Parameters:
      enchantment - the enchantment that triggered this event
      level - the level of the enchantment
      scaledValue - the scaled value from the enchantment's scaling algorithm
      player - the player holding or wearing the item
      item - the enchanted item
      slot - the equipment slot
      isHeld - true if the item is being held in hand
      isArmor - true if the item is worn as armor
      tickCount - the number of ticks represented by the current consecutive scan window
      heldDuration - the approximate held or equipped duration in milliseconds for the current consecutive scan window
  • Method Details

    • getPlayer

      @NotNull public @NotNull org.bukkit.entity.Player getPlayer()
      Gets the player holding or wearing the item.
      Returns:
      the player
    • getItem

      @NotNull public @NotNull org.bukkit.inventory.ItemStack getItem()
      Gets the enchanted item.
      Returns:
      the item
    • getSlot

      @NotNull public @NotNull org.bukkit.inventory.EquipmentSlot getSlot()
      Gets the equipment slot.
      Returns:
      the slot
    • isHeld

      public boolean isHeld()
      Checks if the item is being held in hand.
      Returns:
      true if held
    • isArmor

      public boolean isArmor()
      Checks if the item is worn as armor.
      Returns:
      true if armor
    • getTickCount

      public int getTickCount()
      Gets the tick counter.
      Returns:
      the tick count
    • getHeldDuration

      public long getHeldDuration()
      Gets the duration the item has been held in ticks.
      Returns:
      the held duration
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class EnchantEffectEvent
    • getHandlerList

      @NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()
      Gets the handler list for this event type.
      Returns:
      the handler list