Skip to main content

ReincarnationEvents: Lifespan Events

ReincarnationEvents provides two server events with getType(), getPhase(), isCancellable() and getEvent(). getEvent() returns the native event. event.cancel() stops the current script listener chain; only Pre can cancel the underlying operation.

EventPhasesNative accessors and behaviour
lifespanEndPre, PostgetEntity() and getSpirit() belong to the old life. Pre can cancel: granting positive life resumes ageing; cancellation without renewal closes the ledger. Post adds getOutcome(). Explicit rebirth does not publish this event.
lifespanRebirthPre, Post, FailedDirect expiry rebirth and explicit lifespan rebirth publish it. getEntity(), getSpirit(), getMode(); Pre can cancel. Post supplies the new entity and ledger. Queued failure or cancellation publishes Failed with getFailure().
ReincarnationEvents.lifespanEnd(event => {
if (event.getPhase() !== 'Pre') return
const entity = event.getEvent().getEntity()
if (!entity.getTags().contains('example:immortal')) return
ReincarnationLifespan.unlimited(entity)
event.cancel()
})

Automatic death reincarnation and /reincarnation rebirth use the full reincarnation flow and do not publish these lifespan events.