Class ServerPlayerEvents
java.lang.Object
net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static interface
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Event<ServerPlayerEvents.AfterRespawn>
An event that is called after a player has been respawned.static final Event<ServerPlayerEvents.AllowDeath>
An event that is called when a player takes fatal damage.static final Event<ServerPlayerEvents.CopyFrom>
An event that is called when the data from an old player is copied to a new player. -
Method Summary
-
Field Details
-
COPY_FROM
An event that is called when the data from an old player is copied to a new player.This event is typically called before a player is completely respawned. Mods may use this event to copy old player data to a new player.
-
AFTER_RESPAWN
An event that is called after a player has been respawned.Mods may use this event for reference clean up on the old player.
-
ALLOW_DEATH
An event that is called when a player takes fatal damage.Mods can cancel this to keep the player alive.
Vanilla checks for player health
<= 0
each tick (withLivingEntity.isDead()
), and kills if true - so the player will still die next tick if this event is cancelled. It's assumed that the listener will do something to prevent this, for example:- a minigame mod teleporting the player into a 'respawn room' and setting their health to 20.0
- a mod that changes death mechanics switching the player over to the mod's play-mode, where death doesn't apply
-