PlayerJoin
com.jsmacrosce.jsmacros.client.api.event.impl.world.EventPlayerJoin
Fired when a player-list entry is first added to the client player list.
js
JsMacros.on("PlayerJoin", JavaWrapper.methodToJava(function (event) {
const name = event.player.getName();
Chat.log(`${name === null ? event.UUID : name} joined, ping ${event.player.getPing()} ms`);
}))Constructors
new EventPlayerJoin
new EventPlayerJoin(UUID uuid, PlayerInfo playerInfo)#Wraps a player-list entry in a join event; it does not add the entry or dispatch the event. The supplied UUID is converted to a string independently of the profile in
playerInfo. A null UUID causes a NullPointerException before the player entry is wrapped. playerInfo is required to be non-null but is not eagerly checked; passing null despite that precondition creates a wrapper around null and causes a downstream NullPointerException.Parameters:
uuid: non-null identifier whose string form is stored in UUIDplayerInfo: non-null player-list entry to wrap
Fields
player
The added player-list entry. Its name may be
null when the profile has no name.UUID
UUID of the added player's profile; the same value returned by PlayerListEntryHelper.getUUID() on player.
Methods
toString
Returns an event-name-prefixed diagnostic containing the current player-helper representation, not a full entry snapshot. If
playerInfo was null despite the constructor's non-null precondition, the non-null helper contains a null raw entry; formatting then causes a NullPointerException through helper.getUUID() and base.getProfile().Returns: diagnostic string in the form
eventName:{"player": playerRepresentation}