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
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 ClassesModifier and TypeClassDescriptionstatic enumRepresents the state of a fishing action.Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionFishingEvent(@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 newFishingEvent. -
Method Summary
Modifier and TypeMethodDescription@Nullable org.bukkit.entity.EntityGets the caught entity.@Nullable org.bukkit.entity.ItemGets the caught item.@NotNull org.bukkit.inventory.ItemStackGets the fishing rod item.static @NotNull org.bukkit.event.HandlerListGets the handler list for this event type.@NotNull org.bukkit.event.HandlerList@NotNull org.bukkit.entity.FishHookgetHook()Gets the fish hook entity.@NotNull org.bukkit.LocationGets the location.intGets the lure speed.@NotNull org.bukkit.entity.PlayerGets the player fishing.@NotNull FishingEvent.StategetState()Gets the fishing state.intGets the wait time in ticks.booleanChecks if an entity was caught.booleanChecks if an item was caught.booleanChecks if lure should be applied.booleanisBite()Checks if this is a bite event.booleanbooleanisCast()Checks if this is a cast event.booleanisReel()Checks if this is a reel event.voidsetApplyLure(boolean applyLure) Sets whether lure should be applied.voidsetCancelled(boolean cancelled) voidsetLureSpeed(int lureSpeed) Sets the lure speed.voidsetWaitTime(int waitTime) Sets the wait time in ticks.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
-
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 newFishingEvent.- Parameters:
enchantment- the enchantment that triggered this eventlevel- the level of the enchantmentscaledValue- the scaled value from the enchantment's scaling algorithmplayer- the player fishingfishingRod- the fishing rod itemhook- the fish hook entitylocation- the locationcaughtItem- the caught item, or nullcaughtEntity- the caught entity, or nullstate- the fishing statewaitTime- the wait time in tickslureSpeed- the lure speedapplyLure- 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
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:
isCancelledin interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean cancelled) - Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable
-
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
-