> For the complete documentation index, see [llms.txt](https://wiki.gpplugins.com/playermarketgui/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.gpplugins.com/playermarketgui/playermarketgui/protection-plugins.md).

# Protection plugins

How PlayerMarketGUI handles compatibility with protection plugins

PlayerMarketGUI has integration support with various protection plugins, making sure chest shops can only be created in regions/areas that players are allowed to access.

## WorldGuard

By default, if the plugin detects that WorldGuard is loaded, it adds two custom flags for regions to control whether:

* Players can create chest shops within the region
  * Disabled by default (Enabled by default in the global region)
* Players can buy items from chest shops within the region
  * Enabled by default

## WorldEdit

While this hook doesn't really prevent any events in the plugin, it instead listens to WorldEdit or FastAsyncWorldGuard(FAWE) block change events to see if existing chest shops were replaced with a different block in the world with commands like //set, //replace, ...&#x20;

This is also used by AdvancedRegionMarket and similar plugins that use WorldEdit to clear plots/regions so that chest shops are instantly removed from your world and do not become ghost shops untill the next server restart.

## Lands

If Lands is loaded, the plugin will load two custom Role flags for claims that can be toggled independently:

* A role flag that lets the claim owner toggle the creation of chest shops within their land
* A role flag that toggles buying items from chest shops within the claim

#### Steps to enable

For role flags to show up in GUI's to be toggle able by the land owner, you need to add them to your 'roles.yml' config of lands.

1. Open the `roles.yml` config inside the Lands plugin folder
2. Go to the Lands -> Display section (Should be the first list in the file)
3. Add the `chest_shop_creation` and `chest_shop_purchases` flag

It should end up looking like this:

<div align="left"><figure><img src="https://510971529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMkucDBOmv5LgCnrva2yd%2Fuploads%2F5HA20SYy0aiW4OTbBNxf%2Fimage.png?alt=media&amp;token=f8def194-44a5-4cc9-9627-134d671b2a63" alt=""><figcaption></figcaption></figure></div>

#### Defaults

After that you should set the default behavior of the flags or both flags will default to being disabled for all roles. \
\
Whereas we recommend defaulting the `chest_shop_purchases` flag to all roles and only allowing Owner/Admin roles to create chest shops using the `chest_shop_creation` flag.\
Note that this is just our recommended example, but the defaults can ofcourse be changed to what best fits your server

1. Open the `roles.yml` config inside the Lands plugin folder
2. Go to the Lands -> roles section
3. Expand the section of the role you want to change the default for
4. Add the `chest_shop_purchases` and/or `chest_shop_creation` flag under the 'default' section

Once you configured the new flags within Lands, save the roles config followed by a server restart.\
And if you enabled the fags properly, you should also see the new options inside the 'Action' tab when configuring a role for your /land

## Towny

Towny protects Worlds/regions without a plot by default and thus also won't allow players to create chest shops in the wild unless explicitly enabled in config.

```yaml
# If enabled, overrides Towny's protection in Wild regions and allows players to create chest shops
wild-shop-creation: false
```

By default players are only able to create chest shops in Shop plots within a claim, but when this config setting is disabled, players will be able to create chest shops in whatever region of a claim.

```yaml
only-allow-shop-creation-in-shop-plots: true
```

## ChestProtect

ChestProtect allows players to lock a chest while adding players to be able to manage it aswell, by default the plugin will only allow creating chest shops for trusted players of a chest, whereas stranger players will be able to purchase from it


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://wiki.gpplugins.com/playermarketgui/playermarketgui/protection-plugins.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
