org.bukkit.event.player
Class PlayerFishEvent

java.lang.Object
  extended by org.bukkit.event.Event
      extended by org.bukkit.event.player.PlayerEvent
          extended by 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
static class PlayerFishEvent.State
          An enum to specify the state of the fishing
 
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
 
Field Summary
 
Fields inherited from class org.bukkit.event.player.PlayerEvent
player
 
Constructor Summary
PlayerFishEvent(Player player, Entity entity, Fish hookEntity, PlayerFishEvent.State state)
           
PlayerFishEvent(Player player, Entity entity, PlayerFishEvent.State state)
          Deprecated. replaced by PlayerFishEvent(Player, Entity, Fish, State) to include the Fish hook entity.
 
Method Summary
 Entity getCaught()
          Gets the entity caught by the player.
 int getExpToDrop()
          Gets the amount of experience received when fishing.
static HandlerList getHandlerList()
           
 HandlerList getHandlers()
           
 Fish getHook()
          Gets the fishing hook.
 PlayerFishEvent.State getState()
          Gets the state of the fishing
 boolean isCancelled()
          Gets the cancellation state of this event.
 void setCancelled(boolean cancel)
          Sets the cancellation state of this event.
 void setExpToDrop(int amount)
          Sets the amount of experience received when fishing.
 
Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayer
 
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlayerFishEvent

@Deprecated
public PlayerFishEvent(Player player,
                                  Entity entity,
                                  PlayerFishEvent.State state)
Deprecated. replaced by PlayerFishEvent(Player, Entity, Fish, State) to include the Fish hook entity.

Parameters:
player -
entity -
state -

PlayerFishEvent

public PlayerFishEvent(Player player,
                       Entity entity,
                       Fish hookEntity,
                       PlayerFishEvent.State state)
Method Detail

getCaught

public Entity 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

public Fish getHook()
Gets the fishing hook.

Returns:
Fish the entity representing the fishing hook/bobber.

isCancelled

public boolean isCancelled()
Description copied from interface: Cancellable
Gets 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:
isCancelled in interface Cancellable
Returns:
true if this event is cancelled

setCancelled

public void setCancelled(boolean cancel)
Description copied from interface: Cancellable
Sets 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:
setCancelled in interface Cancellable
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

public PlayerFishEvent.State getState()
Gets the state of the fishing

Returns:
A State detailing the state of the fishing

getHandlers

public HandlerList getHandlers()
Specified by:
getHandlers in class Event

getHandlerList

public static HandlerList getHandlerList()


Copyright © 2014. All rights reserved.