# 🪙 Selling

> **Info:**
The server-wide sell settings are saved in config.yml and edited under **Editor > Settings > Sell Command**.

Players sell an item back to a shop for its sell price. An item with a sell price of 0 cannot be sold. Every sale, whichever way it is made, goes through the same checks as a sale in the shop menu, so requirements and the item's own sell commands still apply.

There are two ways to sell:

* **Inside a shop.** By default, right-clicking an item in a category opens a screen to pick how many to sell, and shift + right-click sells every one the player carries. [Bulk Selling](#bulk-selling) covers selling whole stacks at once.
* **With /sell.** Sells without opening a shop at all, from the hand, the whole inventory or a drop-in menu. See [The /sell Command](#the-sell-command).

`/sell` only sells into the shops on the [Whitelisted Shops](#whitelisted-shops) list.

## The /sell Command

`/sell` sells straight into your shops without opening one. It only sells into the [whitelisted shops](#whitelisted-shops) the player is allowed to open, and when there are none it tells the player there is no shop to sell to.

<figure><img src="../../.gitbook/assets/sell-command/sell-command.png" alt="" width="563"><figcaption><p>Settings (Sell Command)</p></figcaption></figure>

| Command | Permission | Description |
| --- | --- | --- |
| `/sell hand` | phoenixshop.sell.hand | Sells the stack in the main hand. |
| `/sell handall` | phoenixshop.sell.handall | Sells every stack identical to the one in the main hand. |
| `/sell inventory` | phoenixshop.sell.inventory | Sells everything in the inventory the shops buy. |
| `/sell menu` | phoenixshop.sell.menu | Opens the [sell menu](#sell-menu). |

All four permissions are given to operators only by default. Grant them to your player group to open `/sell` to everyone.

### /sell hand

Sells the stack the player is holding in the main hand. The off-hand is never touched. If none of the whitelisted shops buy it, nothing is sold and the player is told the shop does not buy that item.

### /sell handall

Sells the held stack and every other stack in the main inventory and hotbar that is identical to it, same material and same name, lore and data. Copies that differ in any way, such as a renamed one, are left alone.

### /sell inventory

Sells every item in the main inventory and hotbar that one of the whitelisted shops buys. Armor and the off-hand are left alone, and anything no shop buys stays where it is.

### Shulker Boxes

With **Sell Shulker Contents** on, `/sell inventory`, `/sell hand` and the [sell menu](#sell-menu) also sell what is inside shulker boxes. Whatever the shops do not buy stays in the box. It is on by default, and set under **Editor > Settings > Sell Command**.

<figure><img src="../../.gitbook/assets/sell-command/shulker-boxes.png" alt="" width="563"><figcaption><p>Sell Command (Sell Shulker Contents)</p></figcaption></figure>

* `/sell hand` on a box that holds items sells only its contents, never the box. An empty box is sold like any other item, if a shop buys it.
* `/sell inventory` empties the boxes first, then sells the loose items.
* The sell menu accepts a box when anything inside it can be sold, and its worth counts the contents.

AutoSell and sell chests never open shulker boxes.

### Minimum Sale

An item with a [minimum sale](../items/edit-item.md#minimum-sale) is skipped by `/sell` and AutoSell while the player carries fewer than that many.

### How Items Are Matched

Each shop is checked in whitelist order, and within a shop every enabled category and item in turn. The first item that matches a carried stack and has a sell price buys it, so a shop higher on the list always gets first pick.

An item sells in lots of its own amount. If a shop item is 16 cobblestone for a price, a player carrying 40 sells 32 and keeps the remaining 8.

Items whose currency is not available, or that the player does not meet the requirements for, are skipped.

### Earnings in Several Currencies

When the items sold are priced in different currencies, each currency is paid separately and the message lists every total, such as `$120, 4 Gems`.

## Sell Menu

> **Info:**
The menu's layout is menus/&lt;shop&gt;/sell-menu.yml, taken from the first whitelisted shop the player can open.

`/sell menu` opens a chest the player fills with the items they want to sell. Items the whitelisted shops do not buy are refused as they are put in, with the refused sound, so nothing the shops cannot pay for ever sits in the menu.

A shulker box is accepted when something inside it can be sold, while [Sell Shulker Contents](#shulker-boxes) is on.

Items go in by dragging, shift-clicking from the inventory, the hotbar number keys, or the swap-hands key for the off-hand item.

### Drop Slots

The slots items can be put in. By default these are the top five rows, with the bottom row kept for the border and the confirm button. Any slot that is not a drop slot is locked.

### Sell Items

The confirm button. Its lore shows what everything in the drop slots is worth, updated as items go in, and clicking it sells them and closes the menu.

Anything that could not be sold, such as a stack left over after selling in lots, goes back to the player's inventory, or is dropped at their feet if the inventory is full.

### Sell on Close

Whether closing the menu sells what is in it, the same as clicking Sell Items. On by default. When off, closing the menu without clicking Sell Items gives every item back.

This is only set in config.yml. While it is on, the Sell Items lore adds a line telling players that closing sells too.

> **Info:**
Bedrock players get a form instead of the chest while Bedrock sell forms are on. It lists every item in their inventory the shops buy, each with a toggle, and sells the ones left on.

## Whitelisted Shops

The list of shops `/sell` and the sell menu may sell into, in priority order. Only the shop called `shop` is on it by default, so a new shop is left out of `/sell` until you add it.

<figure><img src="../../.gitbook/assets/whitelisted-shops/whitelisted-shops.png" alt="" width="563"><figcaption><p>Sell Command (Whitelisted Shops)</p></figcaption></figure>

A player only sells into the shops on the list they are allowed to open, and a disabled shop is skipped. When none are left for a player, `/sell` tells them there is no shop to sell to.

### Priority

When more than one listed shop buys the same item, the one highest on the list gets it. Put a VIP shop with better prices above the regular one, and give it a permission: VIP players sell at the better price, and everyone else falls through to the regular shop.

<figure><img src="../../.gitbook/assets/whitelisted-shops/priority.png" alt="" width="563"><figcaption><p>Whitelisted Shops (Priority Reordering)</p></figcaption></figure>

**Add Shop** puts a shop at the bottom of the list, and left-clicking a listed shop removes it. To change the order, turn on **Priority Reordering** and click two shops to swap their places.

### Shop No Longer There

A shop that was deleted stays on the list, marked as missing, until you remove it. It is simply skipped when selling.

## Sell Feedback

> **Info:**
These settings are saved in config.yml. They apply to `/sell` and the sell menu, not to selling inside a shop, which uses the shop's own sounds.

### Refused Sound

The sound played when an item is refused by the sell menu, or when `/sell` finds nothing to sell. Written as `SOUND, volume, pitch`. Set it to `none` for silence.

<figure><img src="../../.gitbook/assets/sell-feedback/refused-sound.png" alt="" width="563"><figcaption><p>Sell Command (Refused Sound)</p></figcaption></figure>

### Sold Sound

The sound played after a sale. Written the same way, and `none` turns it off.

<figure><img src="../../.gitbook/assets/sell-feedback/sold-sound.png" alt="" width="563"><figcaption><p>Sell Command (Sold Sound)</p></figcaption></figure>

### Sold Title

Shows a title across the screen after a sale, with the money earned and how many items were sold. On by default.

<figure><img src="../../.gitbook/assets/sell-feedback/sold-title.png" alt="" width="563"><figcaption><p>Sell Command (Sold Title)</p></figcaption></figure>

### Title Time

How long the title stays on screen, in ticks. 20 ticks is 1 second, and the editor keeps it between 10 and 200. The fade-in and fade-out times are only set in the file.

<figure><img src="../../.gitbook/assets/sell-feedback/title-time.png" alt="" width="563"><figcaption><p>Sell Command (Title Time)</p></figcaption></figure>

### Sold Chat Message

Sends a chat message after a sale, with the money earned and how many items were sold. On by default. Turning both this and the title off leaves only the sound.

<figure><img src="../../.gitbook/assets/sell-feedback/sold-chat-message.png" alt="" width="563"><figcaption><p>Sell Command (Sold Chat Message)</p></figcaption></figure>

### Messages

The text of the title and the message lives in the translations file, under the sell section.

| Key | Default |
| --- | --- |
| sell.sold | You sold %items% %items\_word% for %money%. |
| sell.sold-title | +%money% |
| sell.sold-subtitle | You sold %amount% %items\_word% |
| sell.nothing-to-sell | You have nothing the shop will buy. |
| sell.nothing-sold | The shop doesn't buy any of those, so they were given back. |
| sell.returned | %amount% %items\_word% couldn't be sold and went back to your inventory. |
| sell.empty-hand | Hold the item you want to sell. |
| sell.cannot-sell-hand | The shop doesn't buy %item%. |
| sell.no-shops | There is no shop to sell to right now. |

| Placeholder | Description |
| --- | --- |
| %items% / %amount% | How many items were sold. In sell.returned, %amount% is how many were given back. |
| %items\_word% | "item" or "items", to match the count. |
| %money% | What the sale paid, one total per currency. |

## Off-Hand

Whether a player's off-hand item is sold depends on how they sell. There is no setting for this.

| Way of selling | Off-hand |
| --- | --- |
| Selling from a shop's item screen | Counted, together with the inventory. |
| Sell All and shift + right-click in a category | Counted, together with the inventory. |
| Bulk Sell | Counted, together with the inventory. |
| `/sell hand` | Never. Only the main hand is sold. |
| `/sell inventory` | Never. Only the main inventory and hotbar are sold. |
| Sell menu | Only when the player puts it in, with the swap-hands key over a drop slot. |

When a sale counts the off-hand and it holds a matching item, the inventory is used first and the off-hand makes up the rest. Buying from a shop works the same way: what does not fit in the inventory goes into the off-hand, if it is empty or holds the same item.

Armor slots are never sold from.

## Bulk Selling

Inside a shop, players have three ways to sell more than one lot at a time. All of them count the [off-hand](#off-hand) along with the inventory.

### Sell All Click

By default, shift + right-clicking an item in a category sells every one of it the player carries, without opening any screen. This needs the `phoenixshop.sell.all` permission, which only operators have unless you grant it.

The click is set by the click mappings in config.yml, where `SELL_ALL` can be moved to another click or removed.

### Sell All Button

The item's sell screen has a **Sell All** button that sets the amount to everything the player carries, showing what it would pay before they confirm. It needs the same `phoenixshop.sell.all` permission, and shows a barrier to players without it.

### Bulk Sell

The **Bulk Sell** button on the item's sell screen opens a menu with one option per number of stacks, from 1 up to 9, each showing the amount and what it pays. Clicking one sells that many at once, and the menu stays open for another sale. No extra permission is needed.

A stack here is a full stack of the item, 64 for most items and 16 or 1 for items that stack lower.

> **Info:**
The Bulk Sell menu's layout is menus/&lt;shop&gt;/bulk-sell.yml, one per shop.

Source: https://www.phoenixplugins.com/docs/phoenix-shop/main-features/selling