Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 73 lines 1.7 kB view raw
1package org.bukkit.event.player; 2 3import org.bukkit.entity.Entity; 4import org.bukkit.entity.Player; 5import org.bukkit.event.Cancellable; 6 7/** 8 * Thrown when a player is fishing 9 */ 10public class PlayerFishEvent extends PlayerEvent implements Cancellable { 11 private final Entity entity; 12 private boolean cancel = false; 13 private State state; 14 15 public PlayerFishEvent(final Player player, final Entity entity, State state) { 16 super(Type.PLAYER_FISH, player); 17 this.entity = entity; 18 this.state = state; 19 } 20 21 /** 22 * Gets the entity caught by the player 23 * 24 * @return Entity caught by the player, null if fishing, bobber has gotten stuck in the ground or nothing has been caught 25 */ 26 public Entity getCaught() { 27 return entity; 28 } 29 30 public boolean isCancelled() { 31 return cancel; 32 } 33 34 public void setCancelled(boolean cancel) { 35 this.cancel = cancel; 36 } 37 38 /** 39 * Gets the state of the fishing 40 * 41 * @return A State detailing the state of the fishing 42 */ 43 public State getState() { 44 return state; 45 } 46 47 /** 48 * An enum to specify the state of the fishing 49 */ 50 public enum State { 51 52 /** 53 * When a player is fishing 54 */ 55 FISHING, 56 /** 57 * When a player has successfully caught a fish 58 */ 59 CAUGHT_FISH, 60 /** 61 * When a player has successfully caught an entity 62 */ 63 CAUGHT_ENTITY, 64 /** 65 * When a bobber is stuck in the grund 66 */ 67 IN_GROUND, 68 /** 69 * When a player fails to catch anything while fishing usually due to poor aiming or timing 70 */ 71 FAILED_ATTEMPT, 72 } 73}