EntityRemoveEvent
EntityRemoveEvent
Section titled “EntityRemoveEvent”Package:
com.hypixel.hytale.server.core.event.events.entityExtends:EntityEvent<Entity, String>Implements:IEvent<String>Cancellable: No Key type:String
Dispatched when an entity is removed from the world. This is a lifecycle 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 is dispatched with a keyed dispatch. Listeners can filter by the entity’s type key.
Fields / Accessors
Section titled “Fields / Accessors”| Field | Type | Accessor | Mutable | Notes |
|---|---|---|---|---|
entity | Entity | getEntity() | No | The entity being removed from the world. Inherited from EntityEvent. |
Fired By
Section titled “Fired By”Entity.remove()(line 113) viaeventBus.dispatchFor()— 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.