# 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
