# Player Interface

## Summary

1. [Quest slots](#quest-slots)
2. [Item types](#item-types)
   1. [Open another menu from player interface](#open-another-menu-from-player-interface)
   2. [Close on click](#close-on-click)
3. [Placeholders](#placeholders)
4. [Player head](#custom-model-data)
5. [Custom model data](#custom-model-data)
6. [Item model](#item-model)
7. [Oraxen, Nexo & ItemsAdder](#oraxen-nexo-and-itemsadder-items)
8. [Custom head texture](#custom-head-texture)
9. [Multiple slots](#multiple-slots)
10. [Item flags](#item-flags)

## Quest slots

The `quests` section in `playerInterface.yml` defines **where quest items are displayed** in the player GUI.

Two positioning modes are available:

* **Legacy index-based positioning**
* **Category-based fixed positioning** *(recommended)*

Only **one mode should be used at a time**.

### Quest Indexing Reminder

Quests are indexed starting at **1**, based on their loading order.

For example, if you have:

* 3 Easy quests
* 3 Medium quests
* 3 Hard quests

The quest indexes will be:

| Index | Category |
| ----- | -------- |
| 1     | Easy     |
| 2     | Easy     |
| 3     | Easy     |
| 4     | Medium   |
| 5     | Medium   |
| 6     | Medium   |
| 7     | Hard     |
| 8     | Hard     |
| 9     | Hard     |

This means:

* Quest **#1** is the first *Easy* quest
* Quest **#4** is the first *Medium* quest
* Quest **#7** is the first *Hard* quest

### Option 1 — Legacy Index-Based Positioning

This mode assigns a **specific inventory slot to each quest index**.

```yaml
quests:
  1: 12
  2: 21
  3: 30
  4: 14
  5: 23
  6: 32
  7: 16
  8: 25
  9: 34
```

#### How it works

* The key is the **quest index**
* The value is the **inventory slot**
* Quest `1` → slot `12`
* Quest `2` → slot `21`, etc.

#### Notes

* Slots start at **1** (not 0)
* Inventory is counted **left to right, top to bottom**
* If an index is missing, the corresponding quest **will not be displayed**
* This mode is kept for **backward compatibility**

### Option 2 — Category-Based Fixed Positioning (Recommended)

This mode assigns **dedicated slots per quest category**.

```yaml
quests:
  categories:
    easy:
      - 12
      - 21
      - 30
    medium:
      - 14
      - 23
      - 32
    hard:
      - 16
      - 25
      - 34
```

#### How it works

* Categories are **case-insensitive**
* Each category defines a **list of available slots**
* Slots are consumed **in the order quests are loaded**
* The first Easy quest goes to the first Easy slot, the second to the next one, etc.

#### Example

If you have:

* 3 Easy quests
* 3 Medium quests
* 3 Hard quests

They will be placed like this:

| Category | Quest | Slot |
| -------- | ----- | ---- |
| Easy     | #1    | 12   |
| Easy     | #2    | 21   |
| Easy     | #3    | 30   |
| Medium   | #4    | 14   |
| Medium   | #5    | 23   |
| Medium   | #6    | 32   |
| Hard     | #7    | 16   |
| Hard     | #8    | 25   |
| Hard     | #9    | 34   |

#### Advantages

* Stable GUI layout even with [**dynamic quest counts**](https://ordwenplugins.gitbook.io/odailyquests/configuration-file#quests-per-category)
* No need to update slot indexes when quests change
* Works perfectly with **per-category quest limits**
* Cleaner and easier to maintain

### Important Notes

* **Do not mix both modes** at the same time
* If there are **more quests than available slots** in a category, extra quests will not be displayed
* Slots must always be within the inventory size

### Applying Changes

After modifying quest slots, you may need to reset player quests to see the changes:

```
/dqa reset quests <player>
```

## Item types

In the interface configuration, each item you define must have a **type**.\
This type determines what happens when the player clicks on it (or if it simply serves as decoration).

**Available Types**

| Type                  | Description                                                                             | Required Parameters                         |
| --------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------- |
| **`FILL`**            | A decorative item with **no click action**. Useful for filling empty spaces in the GUI. | `material`, `slot`                          |
| **`PLAYER_COMMAND`**  | Executes the listed commands **as the player** when clicked.                            | `name`, `description`, `slot`, `commands[]` |
| **`CONSOLE_COMMAND`** | Executes the listed commands **from the console** when clicked.                         | `name`, `description`, `slot`, `commands[]` |
| **`CLOSE`**           | Simply closes the GUI when clicked.                                                     | `name`, `description`, `slot`               |

Items of type `FILL` are **minimal** — they only display the material and cannot have:

* Custom name
* Lore (description)
* Enchantments, flags, or other visual effects

If you want a decorative item with a custom **name** or **lore** but **no action**,\
use `PLAYER_COMMAND` or `CONSOLE_COMMAND` with an **empty command list**:

```yaml
example_button:
  type: PLAYER_COMMAND
  item:
    material: STONE
    name: "&7Information"
    lore:
      - "&fThis is a custom decorative item"
      - "&fIt does nothing when clicked"
    slot: 10
  commands: [] # no commands -> purely decorative
```

This allows you to use all display features (name, lore, flags) while keeping the item action-free.

### Open another menu from player interface

You want to open another menu from the quest interface?&#x20;

We recommend using a `CONSOLE_COMMAND` type item and a command to force open the target plugin. For example, for Deluxe Menus, this would be `/dm open <menu> <player>`. Otherwise, it may not work properly, as menu commands are not registered in the same way in Bukkit.

```yaml
menu_button:
  type: CONSOLE_COMMAND
  item:
    material: CHEST
    name: "&7Menu"
    lore:
      - "&fOpen the server menu."
    slot: 10
  commands:
    - dm open menu %player%
```

### Close on click

If for some reason you want the player interface to close when the player clicks on it, but don't want to use the `CLOSE` item type, you can use the `close_on_click: true` parameter.

```yaml
spawn_button:
  type: PLAYER_COMMAND
  item:
    material: GRASS_BLOCK
    name: "&7Go to spawn"
    lore:
      - "&fTeleport you to the spawn."
    slot: 10
  commands:
    - spawn
  close_on_click: true # close the inventory while the player is teleported to the spawn
```

## Placeholders

For interface items of type `CLOSE`, `PLAYER_COMMAND` or `CONSOLE_COMMAND`, you can put in the lore some placeholders. Since 3.0, the `use_placeholders` parameter is no longer required.

```
1:
  type: PLAYER_COMMAND
  item:
    material: IRON_BLOCK
    name: "&cSay hello"   
    lore:
      - "Total: %odailyquests_total%"
    slot: 53
  commands:
    - "say hello"
```

You can also put placeholders on the player head in the same way:

```yaml
player_head:
  enabled: true
  item_description:
    - "%player_name%"
```

## Player head <a href="#custom-model-data" id="custom-model-data"></a>

The **Player Head** is a special GUI item representing the player’s own head.\
It is mainly used as an **informational item**, displaying the player’s quest status such as completed quests and the time remaining before the next quest renewal.

This item is purely visual and does not trigger any action when clicked.

#### Options

| Key                | Description                                                                                                                                                |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `enabled`          | Enables or disables the player head item in the interface.                                                                                                 |
| `slot`             | The slot index in the inventory where the player head will be displayed. Can support a list.                                                               |
| `material`         | *(Optional)* Custom material identifier for the head. Can be used to display a custom head provided by an external plugin (e.g. Nexo, ItemsAdder, Oraxen). |
| `item_model`       | *(Optional)* Apply a custom item model to the player head.                                                                                                 |
| `item_name`        | Display name of the item. Supports color codes and placeholders.                                                                                           |
| `item_description` | Lore lines displayed under the item name. Supports color codes and placeholders.                                                                           |

#### Placeholders

The following placeholders can be used in the name and description:

| Placeholder            | Description                                         |
| ---------------------- | --------------------------------------------------- |
| `%player_name%`        | The player’s username.                              |
| `%achieved%`           | Number of quests completed in the current interval. |
| `%odailyquests_total%` | Total number of quests completed by the player.     |
| `%drawIn%`             | Time remaining before new quests are generated.     |

#### Notes

* If `material` is not defined, the item will default to the player’s vanilla head.
* This item is intended for **status display only** and does not open menus or execute actions.
* Color codes use the standard `&` formatting or HEX codes.

```yaml
  player_head:
    enabled: true
    slot: 5
    # material: "nexo:odailyquests_head" # if you want to use a custom head from an external plugin
    item_name: '&b%player_name%'
    item_description:
      - '&3Status: '
      - ' &3&l| &7Completed quests: &b%achieved%&3/&b9'
      - ' &3&l| &7Total completed quests: &b%odailyquests_total%'
      - ' &3&l| &7New quests in: &b%drawIn%'
```

## Custom model data <a href="#custom-model-data" id="custom-model-data"></a>

In the player interface, you can specify a custom model data for the player's head and for different items.&#x20;

* For the player head, you need to add the `custom_model_data` parameter.
* For any other item, you need to add it in the `material` field, as the following example.

For example:

```yaml
player_head:
  enabled: true
  slot: 5
  custom_model_data: 1245 # custom model data for player heads
  item_name: "&bYour quests"
  item_description:
    - "&eCompleted quests : &b%achieved%&e/&63"
    - "&eNext draw in : &c%drawIn%"
    
items:
  1:
    type: PLAYER_COMMAND
    item:
      material: "custommodeldata:REDSTONE:1234" # custom model data for command items
      name: "&cBack"
      lore:
        - "&eGo back to menu."
      slot: 19
    commands:
      - "menu"    
```

## Item model

Since the 3.0.1 version, you can also specify an item model. It also works on the player's head.

* For the player head, you need to add the `item_model` parameter.
* For any other item, you need to add it in the `material` field, as the following example.

For example:&#x20;

```yaml
player_head:
  enabled: true
  slot: 5
  item_model: "odailyquests:playerhead" # item model for player heads
  item_name: "&bYour quests"
  item_description:
    - "&eCompleted quests : &b%achieved%&e/&63"
    - "&eNext draw in : &c%drawIn%"
    
items:
  1:
    type: PLAYER_COMMAND
    item:
      material: "itemmodel:odailyquests:button" # item model for command items
      name: "&cBack"
      lore:
        - "&eGo back to menu."
      slot: 19
    commands:
      - "menu"   
```

## Oraxen, Nexo & ItemsAdder items

You can specify for the material an item from Oraxen, Nexo or ItemsAdder. It's really simple, you just need to add `oraxen:`, `nexo:` or `itemsadder:` before the name of the item.

Ensure that you have the [appropriate option](https://ordwenplugins.gitbook.io/odailyquests/configuration-file#custom-items-support) enabled in the configuration.

```yaml
material: "oraxen:my_item"
material: "nexo:my_item"
material: "itemsadder:namespace:my_item"
```

Don't forget to enclose the item names in inverted commas (`"..."`), otherwise the file will be formatted incorrectly and the plugin will crash!

## Custom head texture

You can also use custom head textures, from [this website](https://minecraft-heads.com/).

You just need to add a `texture` field in the `item` section. The value to put here is the `Minecraft-URL` at the bottom of the head page. Be sure to use the `Minecraft-URL` and **NOT** the `Value` that is just before!

The syntax is the same as for Oraxen, Nexo and ItemsAdder items.

```yaml
// from https://minecraft-heads.com/custom-heads/decoration/60568-coin
material: "customhead:ebda5f31937b2ff755271d97f01be84d52a407b36ca77451856162ac6cfbb34f"
```

## Multiple slots

If you want to set the same item on several slots, for a custom GUI for example, you can do it by creating a list of slots, like this:&#x20;

```yaml
quests: # set the position of quests items
  1: 
    - 12
    - 13
    - 14
  2: 21
  3: 30
```

Here, the quest number 1 will be displayed on slots 12, 13 and 14.

It also works with the player head:

```yaml
player_head:
  enabled: true
  slot: 
    - 8
    - 17
```

## Item flags

Item flags allow you to **hide some default information** from an item in the interface (name, attributes, enchantments, etc.). They are configured directly in the `flags` list of an item inside `player_interface.yml`.

```yaml
pvp_arena:
  type: PLAYER_COMMAND
  item:
    material: DIAMOND_SWORD
    slot: 27
    name: "&cPvP Arena"
    lore:
      - "&7Fight against other players"
      - "&7and prove your strength!"
    flags:
      - HIDE_ATTRIBUTES
      - HIDE_ENCHANTS
  commands:
    - "warp pvp"
```

You can find the list of all available item flags right [here](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/ItemFlag.html).\
This parameter is applicable to all [item types](#item-types).

<details>

<summary>Default playerInterface.yml file</summary>

```
# ======================================================
# Here you can create your own player quests interface.
#
# Never delete a %variable% unless you know what you're doing.
# %achieved% is replaced by the number of completed quests.
# %drawIn% is replaced by the time remaining before the next quests draw.
# ======================================================
player_interface:
  size: 45
  inventory_name: "#0057ff &l        Daily Quests"
  # disable the status of the quest if you want to handle it manually by placeholders
  disable_status: false
  # the 3 following lines will not be used if disable_status is set to true
  status: "&eStatus :"
  progress: "&b%progress%&3/&b%required%"
  achieved: "&bCOMPLETED"
  # if you want to glow the item when the quest is achieved
  glowing_if_achieved: true
  complete_get_type: "&eClick to complete this quest!"
  player_head:
    enabled: true
    slot: 5
    # material: "nexo:odailyquests_head" # if you want to use a custom head from an external plugin
    # item_model: "odailyquests:player_head" # if you want to use a custom item model
    item_name: '&b%player_name%'
    item_description:
      - '&3Status: '
      - ' &3&l| &7Completed quests: &b%achieved%&3/&b9'
      - ' &3&l| &7Total completed quests: &b%odailyquests_total%'
      - ' &3&l| &7New quests in: &b%drawIn%'

  # ========================================================
  # Available types : FILL, PLAYER_COMMAND, CONSOLE_COMMAND
  # Placeholders : %player%
  # More info on Wiki.
  #
  # SLOTS STARTS AT 1!

  # Note: Items of type FILL will be displayed with an empty name and no lore, even if defined.
  # If you want to display a name or lore, use PLAYER_COMMAND or CONSOLE_COMMAND types with an empty command list.
  # ========================================================
  quests: # set the position of quests items
    # Option 1: keep the legacy order-based positioning (quest 1 goes in slot 12, quest 2 in slot 21, etc.).
    # 1: 12
    # 2: 21
    # 3: 30
    # 4: 14
    # 5: 23
    # 6: 32
    # 7: 16
    # 8: 25
    # 9: 34
    # Option 2: define fixed slots per category (case-insensitive). Slots are consumed in the order quests are loaded.
    categories:
      easy:
        - 12
        - 21
        - 30
      medium:
        - 14
        - 23
        - 32
      hard:
        - 16
        - 25
        - 34
  items:
    0:
      type: CLOSE
      item:
        material: BARRIER
        name: "&cClose"
        lore: [ ]
        slot: 37
    1:
      type: PLAYER_COMMAND
      item:
        material: CUSTOM_HEAD
        name: '&b&lInformations'
        texture: cdcdee6d06df234b8e603328b96c57f3a312e79aabfc3be72a8b421878ed68cf
        lore:
          - ' &3&l| &7Everyday you get a new'
          - ' &3&l| &7set of quests.'
          - ''
          - ' &3&l| &7Completing quests will'
          - ' &3&l| &7give you money!'
          - ''
          - ' &8(&7!&8) &7Completing categories will'
          - '  &7 give you extra rewards too'
          - ''
        slot: 1
    2:
      type: PLAYER_COMMAND
      item:
        material: CUSTOM_HEAD
        name: "&b&lDaily reroll"
        texture: bc8def67a12622ead1decd3d89364257b531896d87e469813131ca235b5c7
        lore:
          - ' &3&l| &7Everyday you can change'
          - ' &3&l| &7one of your quests for'
          - ' &3&l| &7a different one'
          - ''
          - ' &8(&7!&8) &7/dq reroll <position>'
        slot: 9
    3:
      type: FILL
      item:
        material: BLUE_STAINED_GLASS_PANE
        slot:
          - 2
          - 3
          - 4
          - 6
          - 7
          - 8
          - 10
          - 18
          - 19
          - 27
          - 28
          - 36
          - 38
          - 39
          - 40
          - 41
          - 42
          - 43
          - 44
          - 45
    4:
      type: FILL
      item:
        material: CYAN_STAINED_GLASS_PANE
        slot:
          - 11
          - 17
          - 20
          - 26
          - 29
          - 35
```

</details>
