> ## Documentation Index
> Fetch the complete documentation index at: https://plugwright.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# API Reference

> Detailed API documentation for advanced users.

## `player` / `bot` Object

The `player` or `bot` object represents a real Minecraft client connected to the test server.

### Methods

#### `player.chat(message)`

Sends a chat message or command.

<ParamField path="message" type="string" required>
  The message or command to send.
</ParamField>

```javascript theme={null}
player.chat('/spawn');
```

#### `player.gui(options)`

Waits for a GUI to open matching the title and returns a live handle.

<ParamField path="options.title" type="string | RegExp" required>
  Pattern to match GUI title.
</ParamField>

```javascript theme={null}
const gui = await player.gui({ title: 'Shop' });
const button = gui.locator(i => i.getDisplayName().includes('Confirm'));
```

### Properties

<ResponseField name="inventory" type="Inventory">
  Access the player's current inventory state.
</ResponseField>

<ResponseField name="username" type="string">
  The randomly generated or assigned name of the bot.
</ResponseField>

## `server` Object

The `server` object gives you control over the backend Minecraft server.

### Methods

#### `server.execute(command)`

Executes a command from the server console.

<ParamField path="command" type="string" required>
  The console command to execute.
</ParamField>

```javascript theme={null}
server.execute(`give ${player.username} diamond 64`);
```
