Package org.bukkit.event.player
Class PlayerFishEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
org.bukkit.event.player.PlayerFishEvent
- All Implemented Interfaces:
Cancellable
public class PlayerFishEvent extends PlayerEvent implements Cancellable
Thrown when a player is fishing
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPlayerFishEvent.StateAn enum to specify the state of the fishing -
Field Summary
-
Constructor Summary
Constructors Constructor Description PlayerFishEvent(Player player, Entity entity, FishHook hookEntity, PlayerFishEvent.State state) -
Method Summary
Modifier and Type Method Description EntitygetCaught()Gets the entity caught by the player.intgetExpToDrop()Gets the amount of experience received when fishing.static HandlerListgetHandlerList()HandlerListgetHandlers()FishHookgetHook()Gets the fishing hook.PlayerFishEvent.StategetState()Gets the state of the fishingbooleanisCancelled()Gets the cancellation state of this event.voidsetCancelled(boolean cancel)Sets the cancellation state of this event.voidsetExpToDrop(int amount)Sets the amount of experience received when fishing.
-
Constructor Details
-
Method Details
-
getCaught
Gets the entity caught by the player.If player has fished successfully, the result may be cast to
Item.- Returns:
- Entity caught by the player, Entity if fishing, and null if bobber has gotten stuck in the ground or nothing has been caught
-
getHook
Gets the fishing hook.- Returns:
- the entity representing the fishing hook/bobber.
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableGets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins- Specified by:
isCancelledin interfaceCancellable- Returns:
- true if this event is cancelled
-
setCancelled
public void setCancelled(boolean cancel)Description copied from interface:CancellableSets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancel- true if you wish to cancel this event
-
getExpToDrop
public int getExpToDrop()Gets the amount of experience received when fishing.Note: This value has no default effect unless the event state is
PlayerFishEvent.State.CAUGHT_FISH.- Returns:
- the amount of experience to drop
-
setExpToDrop
public void setExpToDrop(int amount)Sets the amount of experience received when fishing.Note: This value has no default effect unless the event state is
PlayerFishEvent.State.CAUGHT_FISH.- Parameters:
amount- the amount of experience to drop
-
getState
Gets the state of the fishing- Returns:
- A State detailing the state of the fishing
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-