# Player Repository

## How to create melody player

There are two options how to create melody player. By in-game **Reward UI** or **Manually** in the confiuration file. Both have some restrictions, so if you want use some advanced methods you will need to use combination of them.

### **Using in-game UI**

{% hint style="info" %}
To open **UI** type `/MelodyPlayer Settings`
{% endhint %}

### **Manually in the file**

Configuration file `PlayerRepository.yml` is located at main folder of MelodyPlayer plugin.

#### **Template for the one melody player**

```yaml
MELODY_PLAYER_1:
  Management:
    Author:
      UUID: e2c593d6-f250-4e63-a26e-417650d0e77a
    Contributor:
      c96c68f3-7075-4503-b824-2752f86af0e9:
        AuthorizedActionList:
        - CONTROL_PANEL__OPEN
        - SETTINGS__OPEN
  Name:
   EN: Music Player
  Description:
    EN: Description
  Icon:
    CustomModelData: 0
    Enchantment: false
    Material: GREEN_RECORD
    MaterialData: 0
    Color: 255:255:255
    ItemFlagList:
    - HIDE_ENCHANTS
    - HIDE_ATTRIBUTES
    - HIDE_POTION_EFFECTS
  Active: false
  MelodyList:
  - Animals
  - The Legend of Zelda Theme
  - What is Love
  Volume: 100
  Range: 10
  Level: LOCATION
```

### Explanation of variables

#### Name and Description support multi-localization

```yaml
Name:
  EN: "Melody Player #1"
  SK: "Prehrávač #1"
```

#### Volume

Set the volume level for how loudly the songs are played."

#### Range

Determine the distance from the SpawnPoint within which music can be heard.

#### Melody

List of `melodies` assigned to this melody player.

{% hint style="warning" %}
Recommended to setup via in-game UI.
{% endhint %}

#### Level

Specify the locations where music will be played.

Allowed values:

* `LOCATION` - Around specific location in defined range.
* `WORLD` - Around whole world where the location is placed. - Only one per world can be active!
* `SERVER` - In all worlds on the server. - Only one melody player per server can be active!

#### Activity

Once the melody player has defined all required variables, it's ready to play mucis.

### Finally&#x20;

After successful setting up of the melody players, you need to reload the plugin/player to load new melody palyers.

{% hint style="info" %}
To reload the melody player type `/MelodyPlayer Reload Player <MelodyPlayer>`&#x20;
{% endhint %}

### Management

#### Author

Owner of the Melody Player.

Permissions to manipulate with the whole Melody Player.

#### Contributors

Players that are able to manipulate with MelodyPlayer based on authorized actions.

AuthorizedActions:

* `LOCATION__UPDATE` - Ability to place spawn point of MelodyPlayer
* `LOCATION__HOLOGRAM__UPDATE`  - Ability to place Hologram
* `SETTINGS__OPEN` - Ability to open Settings
  * ❗️Now player is able to change almost everything about MelodyPlayer!
* `CONTROL_PANEL__OPEN` - Ability to control MelodyPlayer - (Pause/Play/Previous/Next/Volume)
* `RELOAD` - Ability to reload MelodyPlayer&#x20;
