EntityRemoveEvent
Package:
com.hypixel.hytale.server.core.event.events.entityExtends:EntityEvent<Entity, String>Implements:IEvent<String>Cancellable: No
Standard event dispatched when an entity is removed from the world. This is a lifecycle notification event that fires during entity removal and cannot be cancelled — by the time listeners receive it, the removal is committed.
Because the key type is String, this event supports keyed dispatch. Listeners can register for a specific entity type key or use registerGlobal() to receive all entity removals.
Fields / Accessors
Section titled “Fields / Accessors”| Field | Type | Accessor | Mutable | Nullable |
|---|---|---|---|---|
entity | Entity | getEntity() | No | No |
- entity — The entity being removed from the world. Inherited from
EntityEvent.
Fired By
Section titled “Fired By”Entity.remove()(line 113) viaeventBus dispatchFor— EventBus keyed dispatch when an entity is removed from the world.
Listening
Section titled “Listening”getEventRegistry().register(EntityRemoveEvent.class, event -> { Entity entity = event.getEntity(); // Perform cleanup when an entity is removed});Related Events
Section titled “Related Events”AddPlayerToWorldEvent— For player entities, this is the corresponding “add” event.EntityRemoveEventcovers all entity types, not just players.