Skip to content

EntityRemoveEvent

Package: com.hypixel.hytale.server.core.event.events.entity Extends: 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.

FieldTypeAccessorMutableNotes
entityEntitygetEntity()NoThe entity being removed from the world. Inherited from EntityEvent.
  • Entity.remove() (line 113) via eventBus.dispatchFor() — keyed dispatch when an entity is removed from the world.
getEventRegistry().register(EntityRemoveEvent.class, event -> {
Entity entity = event.getEntity();
// Perform cleanup when an entity is removed
});
  • AddPlayerToWorldEvent — for player entities, this is the corresponding “add” event. EntityRemoveEvent covers all entity types, not just players.