# PlayerLeave

`com.jsmacrosce.jsmacros.client.api.event.impl.world.EventPlayerLeave`

**Since:** 1.2.7

**Cancellable:** No. Calling `event.cancel()` throws `UnsupportedOperationException`.

Fired when a matching player-list entry is removed from the client player list.  
 ```js
JsMacros.on("PlayerLeave", JavaWrapper.methodToJava(function (event) {
  const name = event.player.getName();  
  Chat.log(`${name === null ? event.UUID : name} left the player list`);  
}))
 ```

## Constructors

### new EventPlayerLeave {#com.jsmacrosce.jsmacros.client.api.event.impl.world.EventPlayerLeave_constructor-UUID-PlayerInfo-}

```js
new EventPlayerLeave(UUID uuid, PlayerInfo player)
```

Captures the UUID string and wraps the removed player-list entry for this event payload.  
 A `null` UUID throws [NullPointerException](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/NullPointerException.html) before the entry is wrapped. The
 arguments are required to be non-null; a null `player` violates that precondition and
 is retained as a null entry inside the helper. This constructor does not itself remove an
 entry, disconnect a player, or dispatch the event.

**Parameters:**
- `uuid`: the required identifier whose string form is captured independently of the entry
- `player`: the required player-list entry to wrap

## Fields

### player {#com.jsmacrosce.jsmacros.client.api.event.impl.world.EventPlayerLeave_player}

```js
player: PlayerListEntryHelper
```

The removed player-list entry.

### UUID {#com.jsmacrosce.jsmacros.client.api.event.impl.world.EventPlayerLeave_UUID}

```js
UUID: String
```

UUID of the entry being removed, in the standard dashed string form.

## Methods

### toString {#com.jsmacrosce.jsmacros.client.api.event.impl.world.EventPlayerLeave_toString-}

```js
toString(): String
```

Returns a diagnostic representation containing the event name and the current helper
 representation of [player](#com.jsmacrosce.jsmacros.client.api.event.impl.world.EventPlayerLeave_player); it is not a JSON serialization or a rendering of the
 separately captured [UUID](#com.jsmacrosce.jsmacros.client.api.event.impl.world.EventPlayerLeave_UUID) field. If the helper wraps a null entry, its representation
 throws [NullPointerException](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/NullPointerException.html) while accessing that entry.

**Returns:** the event name and helper representation in the form `%s:{"player": %s}`
