---
url: https://docs.moqtail.dev/ts/api/player/interfaces/PluginDefinition.md
---
# Interface: PluginDefinition\<Config, Ctx>

Every hook is optional: no `init` means ctx is `undefined`, no `setup` or `negotiated` means true.

## Type Parameters

### Config

`Config` = `void`

### Ctx

`Ctx` = `undefined`

## Properties

### name

> `readonly` **name**: `string`

***

### priority?

> `readonly` `optional` **priority?**: `number`

Lower wins, like `ElementDefinition.priority`. Default 100. Ties go to the earlier entry in `opts.plugins`.

## Methods

### features()?

> `optional` **features**(`ctx`): [`Feature`](../type-aliases/Feature.md)\[]

What the plugin offers, once per player after `init`.

#### Parameters

##### ctx

`Ctx`

#### Returns

[`Feature`](../type-aliases/Feature.md)\[]

***

### init()?

> `optional` **init**(`config`): `Ctx`

Once per player, in the constructor. The config comes from `opts.plugins`.

#### Parameters

##### config

`Config`

#### Returns

`Ctx`

***

### negotiated()?

> `optional` **negotiated**(`ctx`, `serverSetup`): `boolean`

After SERVER_SETUP. False means none of its features are used (its parameters were already sent).

#### Parameters

##### ctx

`Ctx`

##### serverSetup

[`Setup`](../../model/classes/Setup.md)

#### Returns

`boolean`

***

### setup()?

> `optional` **setup**(`ctx`, `clientSetup`): `boolean`

Synchronous, in the constructor. Adds setup parameters to its own `clientSetup`; false drops the plugin.

#### Parameters

##### ctx

`Ctx`

##### clientSetup

[`SetupOptions`](../../model/classes/SetupOptions.md)

#### Returns

`boolean`
