# ShopGui-RedirectClick

This works for a variety of Shop plugins however only shopguiplus was tested for its use.

{% tabs %}
{% tab title="plugin" %}
The name of the shop plugin you use (Found in its plugin.yml)\
This will be used to hook into it during run time
{% endtab %}

{% tab title="MenuName" %}
Within that plugin's config.yml, find the section where the name of the initial shop is. In the case of ShopGUI this is **shopMenuName.**\
\
If the config uses keys, you can also specify that here as such:

```yaml
MenuNameInConfig: "Shop.Menu.Name"
```

{% endtab %}

{% tab title="KeysofItems" %}
This is used to get the items in the main ShopGUI page.\
By doing this, we can later link one of these shops to our custom menu.
{% endtab %}

{% tab title="NameOfItem" %}
Here you combine the layout path for all keys and their name. This allows us to check for item type and item name upon clicking.\
For example:\
\
**shopMenuItems.%key%.item.name** informs us of the layout, where key is a placeholder and servertools will take care of it.&#x20;
{% endtab %}
{% endtabs %}

## Remapped Clicks

To remap the ShopGUI clicks to your own menu (deluxemenus, another plugin menu from command) do the following:

* Name:
  * Specify the exact color code layout as in your ShopGUI config
* CloseInvBeforeCommand:
  * Ensure the ShopGUI closes before the command is run
* MakePlayerSayCommand:
  * Makes play send the message with your command.
  * This is sometimes required if the command does not click but DEBUG shows it has run
* Command:
  * The command which will run upon clicking the specified item in the ShopGUI<br>

```yaml
ShopWorkAround:
  Enabled: false
  DEBUG: false
  plugin: "ShopGUIPlus"
  MenuNameInConfig: "shopMenuName"
  KeysofItemsInConfig: "shopMenuItems"
  NameOfItem: "shopMenuItems.%key%.item.name" # ex. &2&lFarming
  RemappedClicks:
    1:
      name: "&c&lSpawners"
      CloseInvBeforeCommand: true
      MakePlayerSayCommand: true
      command: "spawnershop"
```

### Example:

* User opens /shop
* User finds the spawner item named "\&cSpawners"
* User Clicks
  * ShopGUI closes
  * ServerTools runs command "/customspawnergui"
  * Player opens customSpawnerGui from another plugin without knowing it


---

# Agent Instructions: 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:

```
GET https://servertools.reece.sh/configurations/how-to/shopgui-redirectclick.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
