> For the complete documentation index, see [llms.txt](https://wiki.coldmc.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.coldmc.com/dim/overworld/mechanics/chestshop.md).

# ChestShop

**ChestShop** allows players to create physical shops using a chest and a sign. You can use these shops to buy items from other players or sell your own items to them.

### 🛒 How to Use a Shop (As a Customer)

When you see a shop sign, you can interact with it to trade.

#### Controls

* **Right-Click** the sign to **BUY** items from the shop.
* **Left-Click** the sign to **SELL** items to the shop.

#### Reading the Sign

A shop sign has 4 lines of information. Understanding them is key to knowing if you are getting a good deal.

* **Line 1:** The owner's name.
* **Line 2:** The **quantity** of items involved in one click (e.g., `1`, `64`).
* **Line 3:** The price.
  * **B** stands for **Buy** (You pay money to get the item).
  * **S** stands for **Sell** (You give the item to get money).
* **Line 4:** The name of the item.

> **Example Sign:** `PlayerName` `64` `B 100 : S 20` `Diamond`
>
> *This means: You can **Buy** 64 Diamonds for $100, or you can **Sell** 64 Diamonds back to the shop for $20.*

***

### 🏪 How to Create a Shop (As a Shop Owner)

To set up your own shop, you need a chest, a sign, and the items you want to trade.

#### Step 1: Place the Chest

Place a standard chest on the ground. Put the items you want to sell inside it. *(Note: If you are only buying items from players, you can leave the chest empty, but it must have slots available).*

#### Step 2: Place the Sign

Hold a **Sign** and place it on the chest (hold `Shift`/`Crouch` to place it without opening the chest). You can also place the sign on the wall directly above the chest.

#### Step 3: Write the Sign Information

You must format the sign exactly like this:

| Line  | Content         | Explanation                                                            |
| ----- | --------------- | ---------------------------------------------------------------------- |
| **1** | *(Leave Empty)* | The plugin will automatically fill this with your username.            |
| **2** | `Amount`        | The number of items to buy/sell at once (e.g., `1`, `64`).             |
| **3** | `Prices`        | See **Price Syntax** below.                                            |
| **4** | `Item Name`     | The official name of the item (e.g., `Diamond`, `Cobblestone`) or `?`. |

#### Price Syntax (Line 3)

This line determines if people can buy, sell, or both.

* **Selling to players only:** `B <price>` (Example: `B 100` means players pay 100 to buy from you).
* **Buying from players only:** `S <price>` (Example: `S 10` means you pay players 10 to take their items).
* **Both:** `B <buyprice> : S <sellprice>` (Example: `B 100 : S 10`).

{% hint style="info" %}
If you don't know the exact item name (e.g., is it `Oak_Log` or `Oak_Wood`?), put the item inside the chest and write `?` on **Line 4**. The system will autofill the correct name from the chest contents.
{% endhint %}

***

### 🛠️ Important Commands

* `/iteminfo` Hold an item in your hand and type this command to see its correct ID or name for the shop sign.
* `/shopinfo` Look at a shop sign and type this to view details about the shop.

### ⚠️ Common Mistakes

* **The "B/S" Confusion:** Remember that **B** is what the *customer* does (Buy from you). **S** is what the *customer* does (Sell to you).
* **Out of Stock:** If your chest is empty, players cannot buy from you (even if the sign is correct). You will get a notification when your shop is out of stock.
* **Full Chest:** If your chest is full, players cannot sell items to you.
