# Multi Server Setup

{% hint style="warning" %}
You need a shared **MySQL** database to use this feature.
{% endhint %}

Staff++ added the ability to synchronize multiple features over a multiple servers.\
This guide will explain you how to easily set this up.

### Step 1: installation

Install Staff++ on every server that you want to be synced. **No** plugin is needed for the bungee server.

### Step 2: Database

Configure the database connection inside the configuration file.

```yaml
storage:
  type: 'mysql'
  migrations-table-name: 'migrations'
  mysql:
    host: 'localhost'
    user: 'root'
    database: 'root'
    password: 'mypass'
    port: 3306
```

You **must** configure **mysql** to synchronize the servers.\
Every Staff++ instance must be configured to use the same database

### Step 3: Server name

#### server-name

Search for the property: `server-name` inside the configuration file.\
The server name should be unique for every server. Every server running Staff++ must configure this with a different name. **If you are running a minecraft server network make sure to give this property the same name as the server name used by the network.**

{% hint style="info" %}
I recommend keeping the server-name property alphanumeric. Underscore, dashes and spaces can be used.
{% endhint %}

### Step 4: Server synchronization config

#### server-sync-module

Look for the following section in the configuration file.

```yaml
server-sync-module:
    vanish-sync: false
    staffmode-sync: false
    ban-sync: ''
    report-sync: ''
    warning-sync: ''
    mute-sync: ''
    kick-sync: ''
    notes-sync: ''
```

#### All these properties can be disabled and enabled at any time without impacting previous data.

#### vanish-sync

Allows a player to remain vanished when switching between servers. No join and leave message will be displayed.

#### staffmode-sync

Allows a staff member to keep his staff mode when switching between servers.&#x20;

{% hint style="warning" %}
To use this you must set the properties `enable-on-login` and `disable-on-logout` underneath the **staff-mode** section, to **false**
{% endhint %}

### Data sync

Below properties are all configured in the same way.&#x20;

Inside this property we can configure all other servers we want to be able to read data from. Let's say we have 4 servers all linked to the same Staff++ mysql db. The servers are named `MC1` `MC2` `MC3` and `MC4` . MC1, MC2 and MC4 should share reports, while MC3 has it's own reports. Bans should be shared across all servers. MC2 and MC4 share the same mutes. MC1 and MC3 also share the same mutes.&#x20;

You can leave the property empty if you only want to read data from your own server.

The `[ALL]` value can be used to tell staff++ to read data from all servers.&#x20;

#### MC1 config:

```yaml
server-sync-module:
    ban-sync: '[ALL]'
    report-sync: 'MC1;MC2;MC4'
    mute-sync: 'MC1;MC3'
```

#### MC2 config

```yaml
server-sync-module:
    ban-sync: '[ALL]'
    report-sync: 'MC1;MC2;MC4'
    mute-sync: 'MC2;MC4'
```

#### MC3 config

```yaml
server-sync-module:
    ban-sync: '[ALL]'
    report-sync: ''
    mute-sync: 'MC1;MC3'
```

#### MC4 config

```yaml
server-sync-module:
    ban-sync: '[ALL]'
    report-sync: 'MC1;MC2;MC4'
    mute-sync: 'MC2;MC4'
```

#### ban-sync

When configured players will get banned on every server listed. If nothing filled in, the player is only banned on the server where the ban was initiated.\
This also impacts the Staff GUI. When enabled the staff GUI shows all banned players from all configured servers. If disabled you only see the banned players on the current server.&#x20;

#### report-sync

When enabled, the GUI reports shows all reports a player has made on whatever server the report was created. The infractions GUI will also include players who got reported on other servers

#### warning-sync

When enabled warning thresholds will be calculated based on player warnings from across all configured servers.\
If disabled only warnings from the current server are taken into account.\
\
The list of warnings retrieved shows either all warnings from a player or only the warnings issued from the current server.

#### mute-sync

When enabled players will get muted on every configured server having staff++ installed. If disabled the player is only muted on the server where the mute was initiated.\
This also impacts the Staff GUI. When enabled the staff GUI shows all muted players from all configured servers. If disabled you only see the muted players on the current server.&#x20;

#### kick-sync

This impacts the infractions Staff GUI. When enabled the staff GUI shows all kicks a player has received from all configured servers. If disabled you only see the kicks the player has received from the current server.&#x20;

#### notes-sync

When enabled, the notes displayed linked to a player are shared across all configured servers. If disabled you will only see notes that were created on the current server.
