Class TickEvent
java.lang.Object
org.bukkit.event.Event
io.artificial.enchantments.api.event.EnchantEffectEvent
io.artificial.enchantments.api.event.TickEvent
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
ConstructorsConstructorDescriptionTickEvent(@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 newTickEvent. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull org.bukkit.event.HandlerListGets the handler list for this event type.@NotNull org.bukkit.event.HandlerListlongGets the duration the item has been held in ticks.@NotNull org.bukkit.inventory.ItemStackgetItem()Gets the enchanted item.@NotNull org.bukkit.entity.PlayerGets the player holding or wearing the item.@NotNull org.bukkit.inventory.EquipmentSlotgetSlot()Gets the equipment slot.intGets the tick counter.booleanisArmor()Checks if the item is worn as armor.booleanisHeld()Checks if the item is being held in hand.Methods inherited from class io.artificial.enchantments.api.event.EnchantEffectEvent
checkCancelled, getEnchantment, getLevel, getScaledValue, isCancellableMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
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 newTickEvent.- Parameters:
enchantment- the enchantment that triggered this eventlevel- the level of the enchantmentscaledValue- the scaled value from the enchantment's scaling algorithmplayer- the player holding or wearing the itemitem- the enchanted itemslot- the equipment slotisHeld- true if the item is being held in handisArmor- true if the item is worn as armortickCount- the number of ticks represented by the current consecutive scan windowheldDuration- 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:
getHandlersin classEnchantEffectEvent
-
getHandlerList
@NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()Gets the handler list for this event type.- Returns:
- the handler list
-