Package org.bukkit.event.entity

# Class EntityUnleashEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
org.bukkit.event.entity.EntityUnleashEvent

All Implemented Interfaces:
  `Cancellable`

Direct Known Subclasses:
  `PlayerUnleashEntityEvent`

public class EntityUnleashEvent extends EntityEvent implements Cancellable
Called immediately prior to an entity being unleashed.

Cancelling this event when either:

- the leashed entity dies,
- the entity changes dimension, or
- the client has disconnected the leash

will have no effect.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`EntityUnleashEvent.UnleashReason`

## Nested classes/interfaces inherited from class org.bukkit.event.Event

`Event.Result`

## Field Summary

### Fields inherited from class org.bukkit.event.entity.EntityEvent

`entity`

## Constructor Summary

Constructors
Constructor
Description
`EntityUnleashEvent(@NotNull Entity entity, @NotNull EntityUnleashEvent.UnleashReason reason)`
Deprecated.
`EntityUnleashEvent(@NotNull Entity entity, @NotNull EntityUnleashEvent.UnleashReason reason, boolean dropLeash)`

## Method Summary

Modifier and Type
Method
Description
`static @NotNull HandlerList`
`getHandlerList()`
`@NotNull HandlerList`
`getHandlers()`
`@NotNull EntityUnleashEvent.UnleashReason`
`getReason()`
Returns the reason for the unleashing.
`boolean`
`isCancelled()`
Gets the cancellation state of this event.
`boolean`
`isDropLeash()`
Returns whether a leash item will be dropped.
`void`
`setCancelled(boolean cancel)`
Sets the cancellation state of this event.
`void`
`setDropLeash(boolean dropLeash)`
Sets whether a leash item should be dropped.

### Methods inherited from class org.bukkit.event.entity.EntityEvent

`getEntity, getEntityType`

### Methods inherited from class org.bukkit.event.Event

`callEvent, getEventName, isAsynchronous`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### EntityUnleashEvent

@Deprecated public EntityUnleashEvent(@NotNull @NotNull Entity entity, @NotNull @NotNull EntityUnleashEvent.UnleashReason reason)
Deprecated.

### EntityUnleashEvent

public EntityUnleashEvent(@NotNull @NotNull Entity entity, @NotNull @NotNull EntityUnleashEvent.UnleashReason reason, boolean dropLeash)

## Method Details

### getReason

@NotNull public @NotNull EntityUnleashEvent.UnleashReason getReason()
Returns the reason for the unleashing.

Returns:
  The reason

### isDropLeash

public boolean isDropLeash()
Returns whether a leash item will be dropped.

Returns:
  Whether the leash item will be dropped

### setDropLeash

public void setDropLeash(boolean dropLeash)
Sets whether a leash item should be dropped.

Parameters:
  `dropLeash` - Whether the leash item should be dropped

### 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

### getHandlers

@NotNull public @NotNull HandlerList getHandlers()

Specified by:
  `getHandlers` in class `Event`

### getHandlerList

@NotNull public static @NotNull HandlerList getHandlerList()