> For the complete documentation index, see [llms.txt](https://realisticnode.gitbook.io/rnsetups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://realisticnode.gitbook.io/rnsetups/rnpsmenu/guides/market.md).

# Economy and market

Everything that uses money - the protection block shop, selling and renting regions, taxes, the market and teleport costs - and what happens when a payment fails.

rnPsMenu has no money of its own. It uses **Vault** with your economy plugin (EssentialsX, CMI...). Selling, renting and taxes use **ProtectionStones' own system**, so the menus and `/ps sell`, `/ps rent` and `/ps tax` always agree.

## What needs what

| Feature               | Who pays whom                            | Needs                                                                                  | Turn it off               |
| --------------------- | ---------------------------------------- | -------------------------------------------------------------------------------------- | ------------------------- |
| Protection block shop | Player → server                          | Vault, `rnpsmenu.shop`                                                                 | `shop.enabled: false`     |
| Selling a region      | Buyer → seller                           | Vault, `protectionstones.buysell`                                                      | Don't give the permission |
| Renting a region out  | Tenant → landlord, every period          | Vault, `protectionstones.rent`                                                         | Don't give the permission |
| Taxes                 | Owner → server                           | Vault, `tax_enabled = true` in ProtectionStones' `config.toml`, `protectionstones.tax` | `tax_enabled = false`     |
| Market                | Buys and rents of other players' regions | Vault, `rnpsmenu.market`                                                               | `market.enabled: false`   |
| Teleport cost         | Player → server                          | Vault, `teleport.cost` above 0                                                         | `teleport.cost: 0`        |

"Player → server" means the money is taken and nobody receives it.

{% hint style="warning" %}
**No Vault, no economy**: without Vault and an economy plugin all of this is hidden and the rest of rnPsMenu works as usual. Vault doesn't run on Folia, so it is hidden there too.

**Load order**: ProtectionStones looks for the economy when it starts. If your economy plugin starts after ProtectionStones, the rent periods and taxes that ProtectionStones charges won't work. Make sure the economy plugin loads first.
{% endhint %}

## Payments are safe

Every payment waits for the answer of the economy plugin:

* The balance is checked first, then the money is taken. **If taking the money fails, nothing changes**: no region, no block, no teleport.
* If paying the seller or the landlord fails, the buyer gets the money back and nothing changes. If even that refund fails, the console shows an error with the amount to give back by hand.
* If the seller changed the price after the buyer opened the confirmation, the purchase is refused.
* Prices must be positive numbers (`1,5` and `$100` are understood; 2 decimals are kept).
* If paying taxes fails, the debt stays as it was.
* If a paid teleport is refused (WorldGuard entry deny, a region ban, another plugin), the money is paid back automatically.

## Protection block shop

`/psmenu shop`, or **Main menu > Protection shop**, sells protection blocks. Every block type of ProtectionStones is added to `shop.yml` the first time the plugin sees it, with the `price` of its block type; types with a price above 0 are on sale.

<figure><img src="https://i.imgur.com/uJcI70p.png" alt="The protection block shop"><figcaption><p>The protection block shop</p></figcaption></figure>

```yaml
blocks:
  small:
    enabled: true
    price: 100.0
    amount: 1          # blocks per purchase
    permission: ''     # extra permission to buy
    icon: ''           # item shown ('' = the block itself)
    slot: -1           # place in the menu (0 = top left, -1 = the next free slot)
```

* The player needs `rnpsmenu.shop`, the `permission` of the entry, and the block type's own `permission` in ProtectionStones.
* Clicking a block asks **Buy?** first (`shop.confirm`), so a click by mistake buys nothing. Players who can't buy it see why at once.
* `slot` puts a block in a fixed place of the menu, to arrange the shop as you like; blocks without a slot fill the free content slots. Change it in the editor with **Q** on the block.
* The blocks go to the inventory; if it is full they drop at the player's feet.
* [Flags kept for better blocks](/rnsetups/rnpsmenu/guides/flags.md#flags-kept-for-better-blocks-or-ranks) send players here when they click them.

Edit the shop in game: `/psmenu editor > Shop`.

## Selling a region

**Region menu > Sell / rent / taxes > Sell**, type the price and confirm. The region appears in the market. When someone buys it:

<figure><img src="https://i.imgur.com/3gAQBWB.png" alt="The economy menu of a region: sale, rent and taxes"><figcaption><p>The economy menu of a region: sale, rent and taxes</p></figcaption></figure>

1. The buyer pays (the payment must succeed).
2. The seller gets the money.
3. The buyer becomes the only owner; members, bans and tax autopay are cleared.

* Only owners can sell (not operators), and a region that is rented or offered for rent can't be put on sale.
* The buyer needs the block type's `permission` in ProtectionStones and must be under their region limit.

**Stop selling** takes it off the market.

## Renting a region out

**Rent out**, type the price and how often it is paid (`1d`, `12h`, `1w 2d`...). ProtectionStones' `min/max_rent_price` and `min/max_rent_period` apply. A region on sale can't be rented out (stop selling first).

When someone rents it, the first period is paid at once and ProtectionStones charges the next ones. The tenant becomes a member or an owner (`tenant_rent_role` of the block type), and ProtectionStones' rent limit of the tenant applies. The landlord can **End the rent** and the tenant can **Stop renting** from the same menu; both keep access to it even when ProtectionStones removes every owner of a rented region.

## The market

`/psmenu market`, or **Main menu > Market**, lists every region for sale or for rent, cheapest first. The filter button shows Everything, For sale or For rent.

<figure><img src="https://i.imgur.com/wl6jisd.png" alt="The market: every region for sale or for rent"><figcaption><p>The market: every region for sale or for rent</p></figcaption></figure>

* **Left click**: buy / rent (a confirmation shows the price and your balance).
* **Right click**: visit the region (same wait and countdown as a teleport, and the [teleport cost](#teleport-cost) if there is one).

### Visits

Visits can be limited, so nobody uses the market to teleport into other players' bases:

* **Owners** turn **Visits from the market** on or off in the economy menu of their region (**Sell / rent**). The next owner starts with visits on.
* **The server**: `market.visits: false` turns visits off everywhere.
* **Players** without `rnpsmenu.market.visit` can't visit (everyone has it by default).

When a region can't be visited, the market doesn't show "Right click to visit" on it.

The list is read again every `market.cache-seconds` (default 30).

## Taxes

When `tax_enabled` is on in ProtectionStones, owners can **Pay taxes** (left click: everything owed, right click: an amount) and turn **Tax autopay** on or off.

## Teleport cost

```yaml
teleport:
  cost: 0               # money per teleport to a region (0 = free)
  cost-other-world: 0   # added when the region is in another world
```

* Applies to the teleports of rnPsMenu's menus: region lists, Homes, the region menu and market visits. Region lists show the price.
* It is checked **before the wait**, so nobody waits for a teleport they can't pay, and charged **when the teleport happens**. If the money is gone by then, the player stays where they are.
* If the teleport is then refused (WorldGuard entry deny, a region ban, another plugin), the money is paid back and the player is told so.
* `rnpsmenu.bypass.cost` teleports for free (admins have it).
* ProtectionStones' own `/ps home <name>` and `/ps tp` don't charge it.

## Quick setup

1. Install Vault and an economy plugin, and check the start line in the console says `economy found`.
2. Give your players the ProtectionStones permissions they should use: `protectionstones.buysell`, `protectionstones.rent`, `protectionstones.tax`.
3. Set the prices of the shop in `shop.yml` or `/psmenu editor > Shop`.
4. Optional: turn on taxes in ProtectionStones (`tax_enabled`) and set `teleport.cost`.
