Class FishingEvent

java.lang.Object
org.bukkit.event.Event
io.artificial.enchantments.api.event.EnchantEffectEvent
io.artificial.enchantments.api.event.FishingEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class FishingEvent extends EnchantEffectEvent implements org.bukkit.event.Cancellable
Event fired when a fishing-related enchantment effect triggers.

Carries data about the player, fishing rod, hook, and catch state during fishing actions (cast, reel, bite, caught). This event is cancellable.

Since:
0.1.0
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Represents the state of a fishing action.

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

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

    Constructors
    Constructor
    Description
    FishingEvent(@NotNull EnchantmentDefinition enchantment, int level, double scaledValue, @NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.ItemStack fishingRod, @NotNull org.bukkit.entity.FishHook hook, @NotNull org.bukkit.Location location, @Nullable org.bukkit.entity.Item caughtItem, @Nullable org.bukkit.entity.Entity caughtEntity, @NotNull FishingEvent.State state, int waitTime, int lureSpeed, boolean applyLure)
    Creates a new FishingEvent.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable org.bukkit.entity.Entity
    Gets the caught entity.
    @Nullable org.bukkit.entity.Item
    Gets the caught item.
    @NotNull org.bukkit.inventory.ItemStack
    Gets the fishing rod item.
    static @NotNull org.bukkit.event.HandlerList
    Gets the handler list for this event type.
    @NotNull org.bukkit.event.HandlerList
     
    @NotNull org.bukkit.entity.FishHook
    Gets the fish hook entity.
    @NotNull org.bukkit.Location
    Gets the location.
    int
    Gets the lure speed.
    @NotNull org.bukkit.entity.Player
    Gets the player fishing.
    Gets the fishing state.
    int
    Gets the wait time in ticks.
    boolean
    Checks if an entity was caught.
    boolean
    Checks if an item was caught.
    boolean
    Checks if lure should be applied.
    boolean
    Checks if this is a bite event.
    boolean
     
    boolean
    Checks if this is a cast event.
    boolean
    Checks if this is a reel event.
    void
    setApplyLure(boolean applyLure)
    Sets whether lure should be applied.
    void
    setCancelled(boolean cancelled)
     
    void
    setLureSpeed(int lureSpeed)
    Sets the lure speed.
    void
    setWaitTime(int waitTime)
    Sets the wait time in ticks.

    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

    • FishingEvent

      public FishingEvent(@NotNull @NotNull EnchantmentDefinition enchantment, int level, double scaledValue, @NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.inventory.ItemStack fishingRod, @NotNull @NotNull org.bukkit.entity.FishHook hook, @NotNull @NotNull org.bukkit.Location location, @Nullable @Nullable org.bukkit.entity.Item caughtItem, @Nullable @Nullable org.bukkit.entity.Entity caughtEntity, @NotNull @NotNull FishingEvent.State state, int waitTime, int lureSpeed, boolean applyLure)
      Creates a new FishingEvent.
      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 fishing
      fishingRod - the fishing rod item
      hook - the fish hook entity
      location - the location
      caughtItem - the caught item, or null
      caughtEntity - the caught entity, or null
      state - the fishing state
      waitTime - the wait time in ticks
      lureSpeed - the lure speed
      applyLure - whether to apply lure
  • Method Details

    • getPlayer

      @NotNull public @NotNull org.bukkit.entity.Player getPlayer()
      Gets the player fishing.
      Returns:
      the player
    • getFishingRod

      @NotNull public @NotNull org.bukkit.inventory.ItemStack getFishingRod()
      Gets the fishing rod item.
      Returns:
      the fishing rod
    • getHook

      @NotNull public @NotNull org.bukkit.entity.FishHook getHook()
      Gets the fish hook entity.
      Returns:
      the hook
    • getLocation

      @NotNull public @NotNull org.bukkit.Location getLocation()
      Gets the location.
      Returns:
      the location
    • getCaughtItem

      @Nullable public @Nullable org.bukkit.entity.Item getCaughtItem()
      Gets the caught item.
      Returns:
      the caught item, or null
    • getCaughtEntity

      @Nullable public @Nullable org.bukkit.entity.Entity getCaughtEntity()
      Gets the caught entity.
      Returns:
      the caught entity, or null
    • getState

      @NotNull public @NotNull FishingEvent.State getState()
      Gets the fishing state.
      Returns:
      the state
    • getWaitTime

      public int getWaitTime()
      Gets the wait time in ticks.
      Returns:
      the wait time
    • setWaitTime

      public void setWaitTime(int waitTime)
      Sets the wait time in ticks.
      Parameters:
      waitTime - the new wait time (clamped to non-negative)
    • getLureSpeed

      public int getLureSpeed()
      Gets the lure speed.
      Returns:
      the lure speed
    • setLureSpeed

      public void setLureSpeed(int lureSpeed)
      Sets the lure speed.
      Parameters:
      lureSpeed - the new lure speed (clamped to non-negative)
    • isApplyLure

      public boolean isApplyLure()
      Checks if lure should be applied.
      Returns:
      true if applying lure
    • setApplyLure

      public void setApplyLure(boolean applyLure)
      Sets whether lure should be applied.
      Parameters:
      applyLure - true to apply lure
    • isCast

      public boolean isCast()
      Checks if this is a cast event.
      Returns:
      true if cast
    • isReel

      public boolean isReel()
      Checks if this is a reel event.
      Returns:
      true if reel
    • isBite

      public boolean isBite()
      Checks if this is a bite event.
      Returns:
      true if bite
    • hasCaughtItem

      public boolean hasCaughtItem()
      Checks if an item was caught.
      Returns:
      true if caught item exists
    • hasCaughtEntity

      public boolean hasCaughtEntity()
      Checks if an entity was caught.
      Returns:
      true if caught entity exists
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
    • setCancelled

      public void setCancelled(boolean cancelled)
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
    • 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