Skip to content

EntityRemoveEvent

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

FieldTypeAccessorMutableNullable
entityEntitygetEntity()NoNo
  • entity — The entity being removed from the world. Inherited from EntityEvent.
  • Entity.remove() (line 113) via eventBus dispatchFor — EventBus 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.