# 📝 Config & Command

### Commands

The FurnitureShow plugin provides two main commands: `/nwfurnitureshow` (for administrators) and `/nwfurnitureopen` (for players and searching).

***

#### 1. Admin Commands: `/nwfurnitureshow`

These commands typically require the `command.admin` permission (or the permission you've configured in `config.yml`).&#x20;

```yaml
permissions: #You can change the permissions as you want.
  admin: command.admin
  player: command.player
```

***

**1.1 Reload**

`/nwfurnitureshow reload`

* Reloads the `config.yml` and all furniture category files within the `furniture/` folder.

***

**1.2 AddItem**

`/nwfurnitureshow config additem <category> <price>`

* Adds the item currently held by the player to the specified category.
* Item data will be saved to `plugins/nwFurnitureShow/furniture/<category>.yml`.
* The item's name will be pulled from its custom name or its material name if no custom name is set.

***

**1.3 Set Location**

`/nwfurnitureshow setlocation`&#x20;

* Sets the display location for a specific furniture item to your current coordinates and facing direction.

***

**1.4 Furniture Price**

`/nwfurnitureshow price <true/false>`

* Toggles the ability for players to purchase furniture using in-game money.
* When set to `true`, players can **right-click** furniture items in the GUI to attempt a purchase, provided they have enough money.
* When set to `false`, purchasing with money is disabled

***

#### 2. Player Commands: `/nwfurnitureopen`

These commands typically require the `command.player` permission (or the permission you've configured in `config.yml`).

***

**2.1 Open Furniture GUI**

`/nwfurnitureopen <category>`

* Opens a GUI displaying all furniture items within the specified category.
* **`<category>`**: The name of the category file (e.g., `furnitures`).

```yaml
Examples: 
/nwfurnitureopen furnitures
```

***

**2.2 Search Furniture GUI**

`/nwfurnitureopen search <keyword> [category] [dye]`

* Opens a GUI displaying search results for furniture.
* **`<keyword>`**: The search term. It will search by the item's `name` first, then by its `id` if no name match is found.
  * **Special:** If the `<keyword>` is `-` (a hyphen), it will display **all** furniture items without filtering by name.
* **`[category]`**: (Optional) If specified, the search will be restricted to that particular category.
* **`[dye]`**: (Optional) If `dye` is specified (and the HMCColor system is enabled), only furniture items that are **dyeable** will be shown.
  * **Tab Completion:** `dye` will only appear as a tab completion option if HMCColor is enabled.

```yaml
Examples:
/nwfurnitureopen search chair (Searches for "chair" across all categories)
/nwfurnitureopen search table furnitures (Searches for "table" only within the "furnitures" category)
/nwfurnitureopen search red dye (Searches for "red" across all dyeable categories)
/nwfurnitureopen search - (Displays all furniture items from all categories)
/nwfurnitureopen search - furnitures (Displays all furniture items within the "furnitures" category)
/nwfurnitureopen search chair furnitures dye (Searches for "chair" in the "furnitures" category, and it must be dyeable)
```

<figure><img src="https://1245303946-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEMKTTfYtO1c14jr3rkcH%2Fuploads%2FXo7UJoUoMQuMylFgmJfX%2Fimage.png?alt=media&#x26;token=e9c4e212-f9fb-4775-b9c6-d1deffd39644" alt=""><figcaption></figcaption></figure>

***

### Config

### 1. Configuration Settings (`config.yml` File)

The `config.yml` file is the central hub for customizing the plugin's behavior and messages. You can tailor various sections as follows:

```yaml
# ##########################################################################
#
#                          nwFurnitureShow - Nexo&Itemsadder
#   Created By Discord NN#7999 (Newworld Server)
#   Menu page for browsing Furniture of interest and previewing before purchase.
#   How to use:
#   1. Command /nwfurnitureopen
#   2. Select the area where you want to show the Furniture, then use the command /nwfurniture setlocation
#   3. After adjusting the Config, use the command /nwfurniture config reload
#
#   If you can edit code color Lore, please use MiniMessage.
#   Example: https://docs.advntr.dev/minimessage/format.html
#   Web Editor: https://www.birdflop.com/resources/rgb/
#
# ##########################################################################


#when click right = Buy
#When you enable enable-price: true, it means you are allowing the furniture to be purchasable.
#Command /nwfurnitureshow price true/false
enable-price: false
price-decimals: 1
close-gui-when-click-furniture: false
open-gui-when-click-furniture: false
permissions: # edit up to you
  admin: newworld.furnitureshow.admin
  player: newworld.furnitureshow.player
  free-furniture: newworld.furnitureshow.free_furniture

# display furniture settings
# When Bug /minecraft:kill @e[type=item_display,distance=1..2]
settings:
  cooldown: 5 #5s
  rotate: 0 # 0=False / 1=True
  setGlow: 0 # 0=False / 1=True
  setBrightness: 10 #1-15
  setSkyLight: 10 #1-15

sounds:
  place-preview-furniture: ENTITY_EXPERIENCE_ORB_PICKUP
  open-gui: BLOCK_NOTE_BLOCK_PLING
  buy: BLOCK_ANVIL_DESTROY

hmc-color:
  enabled: false
  gui:
    dye-menu-input-slot: 10
    dye-menu-output-slot: 16
    material-dyeable:
      - 'LEATHER_HORSE_ARMOR'


gui:
  title: "<gradient:#5e4fa2:#f79459>Furniture Show</gradient>"
  search-title: "<gradient:#FF9800:#F44336>Search Results for: <yellow><search></yellow></gradient>"
  rows: 6
  page-size: 45
  previous-page-item:
    #use Nexo ID Or Itemsadder Namespaces or CraftEngine ID
    material: ARROW
    name: "<gold>Previous Page</gold>"
    slot: 48
  current-page-item:
    material: PAPER
    name: "<white>Page <current>/<total></white>"
    slot: 49
    command: "say %player% hi"
  next-page-item:
    material: ARROW
    name: "<gold>Next Page</gold>"
    slot: 50

message:
  default-lore-when-additem:
    - "<gradient:gold:yellow>Price: {price} THB</gradient>"
    - "<#00FF00>Left-click to preview</#00FF00>"
    - "<#FF0000>Right-click to purchase</#FF0000>"
  invalid-price-message: "<red>Invalid value! Use true or false"
  enable-price-message: "<green>Enable Price"
  disable-price-message: "<red>Disable Price"
  set-location-message: "<red>Furniture set location success"
  usage: "<red>Usage: /furnitureshow <config|price> [value]"
  no-permission: "<red>You don't have permission!"
  reload-command: "<#C7E91D>Reloaded"
  error: "Invalid"
  not-found-page: "Page Not Found"
  invalid-page: "Invalid Page"
  cooldown-message: "<yellow>Please wait <gradient:red:yellow><time></gradient> seconds</yellow>"
  set-location-warning: "<gradient:yellow:gold>Use /nwfurnitureshow setlocation to set location.</gradient>"
  not-enough-money: "<red>Not enough money! Price: <price></red>"
  purchase-successful: "<green>You bought <item> for <price></green>"
  inventory-full: "<red>Inventory Full"
  hold-item: "<yellow>You need to be holding the furniture item in your hand.</yellow>"
  not-furniture: "<red>The item you are holding is not recognized as furniture.</red>"
  furniture-exists: "<yellow>This furniture item is already listed in the configuration.</yellow>"
  furniture-added: "<green>Successfully added the furniture item to the configuration.</green>"
  furniture-added-to-category: "<green>Furniture has been added to the Category <yellow>%category%</yellow>!</green>"
  category-not-found: "<red>Category named <yellow>%category%</yellow> not found!</red>"
  usage-open-command: "<red>Usage: /nwfurnitureopen <filename> [page] or /nwfurnitureopen search <name> [category]</red>"
  search-no-results: "<yellow>No furniture found matching the search: <red>%search%</red>.</yellow>"
  search-no-value:
    - "<yellow>Please specify the keyword for the furniture you are looking for:</yellow>"
    - "<gray>Example: /nwfurnitureopen search chair</gray>"
#/nwfurnitureshow setlocation
location:
  world: "world"
  x: 100.5
  y: 65.0
  z: -50.2
  yaw: 0.0
  pitch: 0.0

model_location:
  YHeadRot: 270.0
  YbodyRot: 270.0
  world: "world"
  x: 100.5
  y: 65.0
  z: -50.2
  yaw: 0.0
  pitch: 0.0

```

***

#### Key Settings:

* **`permission`**: Defines the permission node players need to open the plugin's GUI.
* **`close-gui-on-click`**: Set to `true` if you want the GUI to close immediately after a player clicks on a furniture item (e.g., to purchase it).
* **`rows` / `page-size`**: Control the GUI's dimensions and the number of items displayed per page. Be careful to align `page-size` with `rows` and the positions of page navigation buttons.
* **`search-title`**: The format for the GUI's title when players use the search command. `<search>` will be replaced by the actual search term.
* **`*-page-item`**: Configure the **material**, **name** (supports MiniMessage), and **slot position** for the previous, current, and next page navigation buttons.
* **`message`**: This section allows you to customize various messages the plugin sends to players, such as no-permission warnings, invalid command usage, or search results. It **supports MiniMessage** for rich text formatting.

***

### 2. Furniture Management (`furniture/<category>.yml` Files)

The plugin stores furniture data categorized into separate `.yml` files within the `plugins/nwFurnitureShow/furniture/` folder, for example, `plugins/nwFurnitureShow/furniture/furnitures.yml`.

```yaml
# plugins/nwFurnitureShow/furniture/furnitures.yml
hide-this-category: false # Set to true if this category should not appear in the default /nwfurnitureopen GUI
furniture_show:
  arm_chair:
    # Use Nexo ID Or Itemsadder Namespaces or CraftEngine ID
    id: arm_chair
    name: "Arm Chair"
    price: 500 # Price of the furniture item
    lore: # Lore displayed in the GUI (supports MiniMessage)
    - '<gradient:gold:yellow>Price: {price} THB</gradient>'
    - <gray>Medium-sized wooden armchair, good condition.</gray>
    - <#00FF00>Left-click to preview</#00FF00>
    - <#FF0000>Right-click to purchase</#FF0000>
  coffee_table:
    # Use Nexo ID Or Itemsadder Namespaces or CraftEngine ID
    id: coffee_table
    name: "Coffee Table"
    price: 1200
    lore:
    - '<gradient:gold:yellow>Price: {price} THB</gradient>'
    - <gray>Modern style coffee table.</gray>
    - <#00FF00>Left-click to preview</#00FF00>
    - <#FF0000>Right-click to purchase</#FF0000>

```

***

### 3. Minimessage

**MiniMessage** formatting. This means you can use a wide range of colors, styles, and advanced text features to customize how messages appear in-game.

* **MiniMessage Formatting Guide:** <https://docs.advntr.dev/minimessage/format.html>
* **MiniMessage Web Editor (for easy preview):** <https://www.birdflop.com/resources/rgb/>

<figure><img src="https://1245303946-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEMKTTfYtO1c14jr3rkcH%2Fuploads%2FDU2Dn0iBHQkHgw8eFUuK%2F1aqq.png?alt=media&#x26;token=54a77aff-9ea8-45f6-bf17-79f686ad30ce" alt=""><figcaption></figcaption></figure>

***
