Skip to main content
Version: Minecraft 26.2

dev.polymodloader.api.event.player

Generated

This page is generated from the source's Javadoc by ./gradlew apiReference. Do not edit it; fix the source comment and generate it again.

TypeKindDescription
LoginCheckListenerfunctional interfaceListener for PlayerEvents.LOGIN_CHECK.
PlayerCopyListenerfunctional interfaceListener for PlayerEvents.COPY.
PlayerEventsclassPlayer connection and respawn events, fired on the server thread of every server kind.
PlayerJoinedListenerfunctional interfaceListener for PlayerEvents.JOINED.
PlayerLeavingListenerfunctional interfaceListener for PlayerEvents.LEAVING.
PlayerRespawnedListenerfunctional interfaceListener for PlayerEvents.RESPAWNED.

LoginCheckListener​

functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public interface LoginCheckListener

Listener for PlayerEvents.LOGIN_CHECK.

checkLogin(UUID, String)​

Optional<String> checkLogin(UUID playerId, String playerName)

Since 0.1.0-alpha.4 or earlier

Returns a reason to refuse the player, shown on their disconnect screen, or empty to let them in. Runs after the game's own ban and whitelist checks passed, before the player exists.

ParameterTypeDescription
playerIdUUID—
playerNameString—

Returns Optional<String>

PlayerCopyListener​

functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public interface PlayerCopyListener

Listener for PlayerEvents.COPY.

onPlayerCopy(PlayerView, PlayerView, boolean)​

void onPlayerCopy(PlayerView oldPlayer, PlayerView newPlayer, boolean returnedFromEnd)

Since 0.1.0-alpha.4 or earlier

Called on the server thread while the game builds the new player object for a respawn, after the game copied what it keeps (inventory with keepInventory, everything when returning from the End) and after Poly Mod Loader copied EntityDataKey data. Copy anything else the mod keeps per player object here.

ParameterTypeDescription
oldPlayerPlayerViewthe player object being replaced; valid only during the call
newPlayerPlayerViewthe new player object, not yet in a world; valid only during the call
returnedFromEndbooleantrue when leaving the End (alive), false after death

PlayerEvents​

class · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public final class PlayerEvents

Player connection and respawn events, fired on the server thread of every server kind.

Constant or fieldTypeDescription
COPYEventKey<PlayerCopyListener>The game is building the new player object for a respawn (after death or when leaving the End) and copying data from the old one. Fabric API: ServerPlayerEvents.COPY_FROM; NeoForge: PlayerEvent.Clone.
RESPAWNEDEventKey<PlayerRespawnedListener>A player respawned and the new player object is in its world. Fabric API: ServerPlayerEvents.AFTER_RESPAWN; NeoForge: PlayerEvent.PlayerRespawnEvent.
JOINEDEventKey<PlayerJoinedListener>A player finished joining the server and is in the world.
LEAVINGEventKey<PlayerLeavingListener>A player is about to be removed from the server (disconnect or kick).
LOGIN_CHECKEventKey<LoginCheckListener>A player is logging in (after authentication and the game's ban, whitelist, and player-limit checks); any listener may refuse them. Fired on the server thread.

PlayerJoinedListener​

functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public interface PlayerJoinedListener

Listener for PlayerEvents.JOINED.

onPlayerJoined(PlayerView)​

void onPlayerJoined(PlayerView player)

Since 0.1.0-alpha.4 or earlier

Called on the server thread; player is valid only during the call.

ParameterTypeDescription
playerPlayerView—

PlayerLeavingListener​

functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public interface PlayerLeavingListener

Listener for PlayerEvents.LEAVING.

onPlayerLeaving(PlayerView)​

void onPlayerLeaving(PlayerView player)

Since 0.1.0-alpha.4 or earlier

Called on the server thread before the player is removed; player is valid only during the call.

ParameterTypeDescription
playerPlayerView—

PlayerRespawnedListener​

functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public interface PlayerRespawnedListener

Listener for PlayerEvents.RESPAWNED.

onPlayerRespawned(PlayerView, boolean)​

void onPlayerRespawned(PlayerView player, boolean returnedFromEnd)

Since 0.1.0-alpha.4 or earlier

Called on the server thread after the new player object was placed in its world.

ParameterTypeDescription
playerPlayerViewthe new player; valid only during the call
returnedFromEndbooleantrue when the player left the End through the exit portal (alive), false after death
Buy me a coffee