# GUI Formatting

Welcome to the BedHome plugin GUI formatting guide! In this guide, you'll learn how to customize the graphical user interface (GUI) for your BedHome plugin, enhancing the user experience for your Minecraft server players.

### Introduction

The GUI in your BedHome plugin allows players to manage their homes conveniently. By configuring the GUI settings, you can control the appearance and functionality of different slots within the interface. Let's dive into the details of GUI configuration.

### GUI Configuration

In your plugin's `config.yml` file, you'll find a section dedicated to GUI settings. Here, you can set the GUI title, size, and customize individual items within the GUI. The following options are available:

* `guiTitle`: Set the title of the GUI displayed to players.
* `guiSize`: Choose the GUI size from 1 to 6, representing 9 to 54 slots. Use 0 for automatic adjustment.
* `items`: Configure different item types within the GUI.

### Item Types

The GUI items are categorized into several types:

1. **availableSlot**: Represents a slot without a location assigned.
   * Available variables:
     * `{player}`: Displays the player's name.
     * `{slot}`: Displays the slot number.
2. **occupiedSlot**: Represents a slot with an assigned location.
   * Available variables:
     * `{player}`: Displays the player's name.
     * `{slot}`: Displays the slot number.
     * `{x}`, `{y}`, `{z}`: Displays the coordinates of the assigned location.
     * `{world}`: Displays the world name of the assigned location.
3. **purchaseSlot**: Represents a slot available for purchase.
   * Available variables:
     * `{player}`: Displays the player's name.
     * `{slot}`: Displays the slot number.
     * `{price}`: Displays the price for the slot.
4. **placeholderSlot**: Placeholder item.
5. **errorSlot**: Represents an error condition.
   * Available variables:
     * `{player}`: Displays the player's name.
     * `{error}`: Displays an error message.

Each item type can be customized with its own material, display name, lore, and additional attributes.

### Using PLAYER\_HEAD and customModelData

#### PLAYER\_HEAD

To use a custom player head as an item, set the material to `PLAYER_HEAD` and provide a base64-encoded texture URL under the `texture` attribute. Example:

```yaml
yamlCopy codeoccupiedSlot:
  material: PLAYER_HEAD
  texture: '...'  # Base64-encoded texture URL
  displayName: '<gray>Slot <green>{slot}'
  lore:
    - '<gray>'
    - '<gray>X: &e{x}<gray>, Y: &e{y}<gray>, Z: &e{z}'
    - '<gray>World: &a{world}'
    - '<gray>'
    - '&e&n(LMB)<gray> Teleport to this bed'
    - '&e&n(Drop Button)<gray> Reset location of this bed'
```

#### customModelData

To assign a custom model data value to an item, use the `customModelData` attribute. Example:

```yaml
yamlCopy codepurchaseSlot:
  material: PAPER
  customModelData: '1542'
  displayName: '<red>Slot {slot}'
  lore:
    - '<gray>'
    - '<gray>Buy this slot for &a&n{price}$'
    - '<gray>'
    - '&e(Click) <gray>To buy this slot'
```

### Example Configurations

#### 1.

```yaml
gui:
  guiTitle: '<red>Homes'
  guiSize: 0
  items:
    availableSlot:
      material: RED_BED
      displayName: '&eSlot {slot}'
      lore:
        - '<red>'
        - '<green>(Click) <gray>Set location to this bed.'
    occupiedSlot:
      material: GREEN_BED
      displayName: '&aSlot {slot}'
      lore:
        - '<gray>'
        - '<gray>X: &e{x}<gray>, Y: &e{y}<gray>, Z: &e{z}'
        - '<gray>World: &a{world}'
        - '<gray>'
        - '&e&n(LMB)<gray> Teleport to this bed'
        - '&e&n(Drop Button)<gray> Reset location of this bed'
    purchaseSlot:
      material: GRAY_BED
      displayName: '<red>Slot {slot}'
      lore:
        - '<gray>'
        - '<gray>Buy this slot for &a&n{price}$'
        - '<gray>'
        - '&e(Click) <gray>To buy this slot'
    placeholderSlot:
      material: BLACK_STAINED_GLASS_PANE
      displayName: '<gray>'
    errorSlot:
      material: BARRIER
      displayName: '<red>{error}'
```

#### 2.

```yaml
gui:
  guiTitle: '<red>Homes'
  guiSize: 0
  items:
    availableSlot:
      material: RED_STAINED_BLASS_PANE
      displayName: '&eSlot {slot}'
      lore:
        - '<red>'
        - '<green>(Click) <gray>Set location to this bed.'
    occupiedSlot:
      material: GREEN_STAINED_GLASS_PANE
      displayName: '&aSlot {slot}'
      lore:
        - '<gray>'
        - '<gray>X: &e{x}<gray>, Y: &e{y}<gray>, Z: &e{z}'
        - '<gray>World: &a{world}'
        - '<gray>'
        - '&e&n(LMB)<gray> Teleport to this bed'
        - '&e&n(Drop Button)<gray> Reset location of this bed'
    purchaseSlot:
      material: YELLOW_STAINED_GLASS_PANE
      displayName: '<red>Slot {slot}'
      lore:
        - '<gray>'
        - '<gray>Buy this slot for &a&n{price}$'
        - '<gray>'
        - '&e(Click) <gray>To buy this slot'
    placeholderSlot:
      material: BLACK_STAINED_GLASS_PANE
      displayName: '<gray>'
```

### MiniMessage Formatting

You can utilize MiniMessage formatting for rich text effects in messages. MiniMessage supports gradients, rainbow effects, and HEX colors, making your GUI messages more engaging.

For more detailed MiniMessage formatting options, check the official guide [here](https://docs.advntr.dev/minimessage/format.html).

### Conclusion

With the knowledge gained from this guide, you can now confidently configure your BedHome plugin GUI to create a visually appealing and user-friendly experience for your players.

Feel free to experiment with different configurations to match your server's style and preferences. Happy customizing!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pqdev.gitbook.io/docs/plugin-usage/gui-formatting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
