001 package org.bukkit.event.player; 002 003 import org.bukkit.entity.Entity; 004 import org.bukkit.entity.Player; 005 import org.bukkit.event.Cancellable; 006 import org.bukkit.event.entity.EntityUnleashEvent; 007 008 /** 009 * Called prior to an entity being unleashed due to a player's action. 010 */ 011 public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Cancellable { 012 private final Player player; 013 private boolean cancelled = false; 014 015 public PlayerUnleashEntityEvent(Entity entity, Player player) { 016 super(entity, UnleashReason.PLAYER_UNLEASH); 017 this.player = player; 018 } 019 020 /** 021 * Returns the player who is unleashing the entity. 022 * 023 * @return The player 024 */ 025 public Player getPlayer() { 026 return player; 027 } 028 029 public boolean isCancelled() { 030 return cancelled; 031 } 032 033 public void setCancelled(boolean cancel) { 034 this.cancelled = cancel; 035 } 036 }