# Plugin Events

Plugins can override event methods so they can be notified when specific things happens.\
For now there's only 3 events but more can be added upon request.<br>

{% tabs %}
{% tab title="OnWorldLoaded" %}
This event will be triggered when the game has finished loading the world/save.

```csharp
void OnWorldLoaded()
```

{% endtab %}

{% tab title="Example" %}

```csharp
public override void OnWorldLoaded()
{
    Log("The world has loaded!");
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="OnPlayerConnected" %}
This event will be triggered when a player connects to the server.

```csharp
void OnPlayerConnected(Player player)
```

{% endtab %}

{% tab title="Example" %}

```csharp
public override void OnPlayerConnected(Player player)
{
    Log($"{player.PlayerName} has joined the game!");
    player.SendChatMessage($"Welcome to the server {player.PlayerName}.");
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="OnPlayerDisconnected" %}
This event will be triggered when a player disconnects from the server.

```csharp
void OnPlayerDisconnected(Player player)
```

{% endtab %}

{% tab title="Example" %}

```csharp
public override void OnPlayerDisconnected(Player player)
{
    Log($"{player.PlayerName} has left the game!");
}
```

{% endtab %}
{% endtabs %}

Want more events ? DM me on discord with the events you'd like and i can take a look at adding it.
