Add Fish (Hook) entity to PlayerFishEvent. Adds BUKKIT-1025

This commit is contained in:
Andre LeBlanc 2013-02-26 15:54:47 -05:00 committed by Kane Y
parent a8f96663ee
commit f416636f06

View File

@ -1,5 +1,6 @@
package org.bukkit.event.player; package org.bukkit.event.player;
import org.bukkit.entity.Fish;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -14,10 +15,24 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
private boolean cancel = false; private boolean cancel = false;
private int exp; private int exp;
private final State state; private final State state;
private final Fish hookEntity;
/**
* @deprecated replaced by {@link #PlayerFishEvent(Player, Entity, Fish,
* State)} to include the {@link Fish} hook entity.
* @param player
* @param entity
* @param state
*/
@Deprecated
public PlayerFishEvent(final Player player, final Entity entity, final State state) { public PlayerFishEvent(final Player player, final Entity entity, final State state) {
this(player, entity, null, state);
}
public PlayerFishEvent(final Player player, final Entity entity, final Fish hookEntity, final State state) {
super(player); super(player);
this.entity = entity; this.entity = entity;
this.hookEntity = hookEntity;
this.state = state; this.state = state;
} }
@ -30,6 +45,14 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
return entity; return entity;
} }
/**
* Gets the fishing hook.
* @return Fish the entity representing the fishing hook/bobber.
*/
public Fish getHook() {
return hookEntity;
}
public boolean isCancelled() { public boolean isCancelled() {
return cancel; return cancel;
} }