# Commands:

#### Legend:

* Any value bracketed by **`<value>`** (angle brackets) is a **required** value
* Any value bracketed by **`[value]`** (square brackets) is an **optional** value, and can be omitted from command execution if not needed/desired

## Commands:

* **`/shop [player]`** = Open the shop
  * Note:  the optional argument`[player]` can only be specified in console.
* **`/shop <section> [player]`** = Open a shop section directly from the command instead of typing /shop and choosing a shop section
  * Note:  the optional argument`[player]` can only be specified in console.
* **`/sellall`** = Sell all items from your inventory
* **`/sellall <material>`** = Sell all items in your inventory that match the specified [material](https://www.digminecraft.com/lists/item_id_list_pc.php)
* **`/sellall hand`** = Sell the item stack that you are currently holding in your hand
* **`/sreload`** = Reloads the plugin and shops([Sections.yml](https://wiki.gpplugins.com/economyshopgui/file-configuration/sections.yml) and [Shop.yml](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml)). \*Some settings in the [Config.yml](https://wiki.gpplugins.com/economyshopgui/file-configuration/config.yml) require a server restart to take effect!
* **`/shopgive <section> <itemIndex> [player]`** = Allows admins to give a certain shop item to players or them self to test them for example.
* **`/editshop additem <section> <material> <buy price> <sell price> [displayname]`** = [Add an item](#adding-items) to a specific shop section with this command
* **`/editshop edititem <section> <itemIndex> <action> <key> <value>`** = Allows you to [edit an existing item](#editing-items) in the shop
* **`/editshop deleteitem <section> <itemIndex>`** = This command allows you to [remove an item](#deleting-items) from the shop
* **`/editshop import Essentials worth.yml`** = Import all items sell prices from the worth.yml of essentials
* **`/editshop addhanditem <section> <buy price> <sell price>`** = With this oommand you can add items from your hand to the shop. (Great for items with hidden/special NBT data!)
* **`/sellgui [player]`** = This command opens a empty inventory where you can drop items in to sell, closing the inventory will complete the transaction and will give the items that couldn't be sold back to the player
* **`/editshop addsection <section> <material> <displayname> <place>`** = Allows u to add a shop section
* **`/editshop editsection <section> <action> <key> <value>`** = Allows you to edit a existing shop section
* **`/editshop deletesection <section>`** = Removes a section from the sections.yml configuration
* **`/editshop uploadLayout`** = Starts the upload process of your current layout
* **`/editshop installLayout <layoutID>`** = Starts the install process from a premade shop layout
* **`/editshop updateLayout <layoutID>`** = Allows updating existing layouts from our layout website (You cannot use this command if you aren't the author of the layout)
* **`/editshop shopstands give <blockType> <section> <itemIndex>`** = Give yourself a new shop stand item which can be placed anywhere on the ground
* **`/editshop shopstands browse`** = Opens a GUI which shows all existing shop stands on the server
* **`/editshop shopstands destroy <standID>`** = Destroy a shop stand by its ID
* **`/eshop logs export`** - Exports the current logged transactions to a web site for easy a easy overview/inspecting

#### <mark style="color:yellow;">\*Premium version only commands:</mark>

* **`/shop search`** - Brings up a search bar to search for shop items matching their material name
* **`/editshop update`** - Downloads new versions from a ingame command
* **`/editshop import EconomyShopGUI all`** - Allows you to import config files from the free version [How to use this command](#import-command)
  * You should only need to use this command **once** when upgrading from [Free to Premium](https://gpplugins.gitbook.io/economyshopgui/basics/how-to#upgrade-to-premium).
* **`/editshop import shopguiplus all`**- Allows data importing from ShopGUI+
* **`/editshop globalstock set/add/reset <section> <index> [amount]`** - Can be used to edit the global stock on a item
* **`/editshop playerstock set/add/reset <player> <section> <index> [amount]`** - Can be used to edit the player stock on a item
* **`/editshop globalsell set/add/reset <section> <index> [amount]`** - Can be used to edit the global sell limit on a item
* **`/editshop playersell set/add/reset <player> <section> <index> [amount]`** - Can be used to edit the player sell limit on a item
* **`/editshop dynamicpricing reset <all/section> [index]`** - Allows to reset the DynamicPricing of a specific item, from a sepecific section or all items at the same time
* **`/editshop database cleanup <dataType>`** - Allows to remove expired data from the database to cleanup and reduce file size

## Using the editshop command:

### Adding items:

There are two ways to add items to shop via commands:

* Adding items from you inventory which are configured automatically is as easy as: **`/eshop addhanditem`**
* Adding items to the shop manually can be done using the command **`/editshop additem <section> <material> <buy price> <sell pirce> [displayname]`**.
  * You may need to use **`/sreload`** after adding items to load the new items.

#### Command Breakdown:

* **`/editshop additem <section> <material> <buy price> <sell price> [displayname]`**
* **`<section>`** = The [section](https://wiki.gpplugins.com/economyshopgui/file-configuration/sections.yml) where you want to add the item
* **`<material>`** = The [material](https://www.digminecraft.com/lists/item_id_list_pc.php) of the item
* **`<buy price>`** = Price the player will pay to [Buy/Purchase](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml#buy) the item
* **`<sell price>`** = Price the player will receive when [selling the item to the server](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml#sell)
* **`[displayname]`** = *\[Optional]* The [displayname](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml#display-name) you want to give the item. It can contain spaces, '&' color-codes and special characters.
* \*An ***index*** for the new item will automatically be created when it is successfully added.&#x20;
* \*[Additional settings](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml#item-settings) (most are optional, but some are needed) may need to be added with the `edititem` command after this command (ex: `Spawnertype` is required to set the mobtype when ESGUI is the [spawner-handler](https://wiki.gpplugins.com/economyshopgui/file-configuration/config.yml#spawner-settings))

### Editing items:

Editing items is just that easy as adding items, just enter the **`/editshop edititem <section> <index> <action> <key> <value>`** command.

* You may need to use **`/sreload`** after editing items to load the changes.

#### Command Breakdown:

* **`/editshop edititem <section> <index> <action> <key> <value>`**
* **`<section>`** = The [section](https://wiki.gpplugins.com/economyshopgui/file-configuration/sections.yml) of the item you want to edit.
* **`<index>`** = The index of the item you want to edit.
  * See [**here**](https://wiki.gpplugins.com/economyshopgui/how-to#obtaining-item-indexes-of-shop-items) how to find the index of a shop item
* **`<action>`** = the action for the key. Valid options are: **`add, set, remove`**
* **`<key>`** = the key you wish to edit, aka key '[potiontypes](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml#potion-types)', '[enchantments](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml#enchantments)', '[spawnertype](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml#spawner-type)', etc... [Look here for all available keys](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml#item-keys-list-quick-reference-index).
* **`<value>`** = the value of the key, aka if you have selected key '[potiontypes](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml#potion-types)', you need to enter a potion-type value

### Deleting items:

You already can guess how easy it is, just type the command **`/editshop deleteitem <section> <index>`** to delete a item from a specified shop section.

* You will need to use **`/sreload`** after removing items to load the changes to the shop.

#### Command Breakdown:

* **`/editshop deleteitem <section> <index>`**
* **`<section>`** = The [section](https://wiki.gpplugins.com/economyshopgui/file-configuration/sections.yml) of the item you want to remove.
* **`<index>`** = The index of the item you want to edit.
  * See [**here**](https://wiki.gpplugins.com/economyshopgui/how-to#obtaining-item-indexes-of-shop-items) how to find the index of a shop item

## Adding existing items from your inventory:

It is possible to add already existing items from your inventory to shop by holding them in your hand.\
The plugin will then configure the item for you inside the shops config using the correct format.

* `/editshop  addhanditem <section> <buy price> <sell price> [display name]`
  * You may need to use **`/sreload`** after adding items to load the new items correctly into their shops.

{% hint style="warning" %}
When adding the **-unsafe** flag behind the command, the item will be added using its NBT/component data instead of the item options configured by the plugin.&#x20;

This is known to fix issues with items that have complex item names/lore
{% endhint %}

#### Command Breakdown:

* **`/editshop addhanditem <section> <buy price> <sell price>`**
* **`<section>`** = The [section](https://wiki.gpplugins.com/economyshopgui/file-configuration/sections.yml) where you want to add the item to
* **`<buy price>`** = The buy price of this item
* **`<sell price>`** = The sell price of this item

{% hint style="info" %}
Tab Completion in MC V1.13+ is quite useful for filling in most parts of the commands.
{% endhint %}

## Using the import command <a href="#import-command" id="import-command"></a>

Worried about losing data? The import command allows you to import the following options:

### ShopGUI+: *<mark style="color:yellow;">\*Premium feature</mark>* <a href="#shopgui" id="shopgui"></a>

The premium version of the plugin has build in commands to import the settings/current shop data from ShopGUI+.

* The **`/editshop import shopguiplus all`** command will create a quickand easy summary of the items/sections/settings which can be imported, this won't import the data directly into your current configs.
  * Once satisfied with the results of the summary you can run the command **`/editshop import shopguiplus all confirm`** to complete the import.

{% hint style="info" %}
Note that this command will do its best to import the shop from ShopGUI+ as best as possible, with that sayd, it might not reflect all changes 100% to match EconomyShopGUI.
{% endhint %}

### EconomyShopGUI(Free version): *<mark style="color:yellow;">\*Premium feature</mark>* <a href="#economyshopgui" id="economyshopgui"></a>

If you have a fresh install of the premium version and haven't changed any of the files/shops; you can use the import command to copy the files from the data folder of the free version to the premium version.

* **`/editshop import EconomyShopGUI all`** will import all existing shops, section s and config.yml configurations to ensure a smooth transition to the premium version.

{% hint style="success" %}
It is possible to copy and paste your files manually between versions, but it is recommended to use the import command.
{% endhint %}

### Essentials worth.yml: <a href="#worth.yml" id="worth.yml"></a>

* **`/editshop import essentials worth.yml`** this will import items sell prices from the worth.yml of EssentialsX to EconomyShopGUI automatically. Note that the sell prices from worth.yml will be replaced with the current sell prices inside the [shops](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml) configuration.

{% hint style="info" %}
The current config is copied to the backups folder in case of error when you import or update the plugin.
{% endhint %}

## How to use the editshop command to set limited stock for a item:

The limited stock feature is a premium feature which can help to make special edition items on your server by limiting the amount there can be purchased from shop.

* **`/editshop globalstock set <section> <index> <amount>`** This will set the limited stock for the item for the whole server as the specified amount
* **`/editshop playerstock set <player> <section> <index> <amount>`** This will set the limited stock for the item for the specified player as the specified amount

{% hint style="warning" %}
Note that setting the limited stock for a item that hasn't [the limited stock settings](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml#global-stock-premium-feature) specified in the shops.yml **won't** make it a limited item, for that you will first need to specify the [base settings inside the shops.yml](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml#player-stock-premium-feature)
{% endhint %}

## How to use commands to add/edit/delete Items:

### Adding a new Item:

* Command Syntax:
  * **`/editshop additem <section> <material> <buy price> <sell pirce> [displayname]`**
    * **`<section>:`** The section/shop category to add this item to
    * **`<material>:`** The item type of the new item
    * **`<buy price>:`** The buy price of the shop item
    * **`<sell price>:`** The sell price of the shop item
    * The **`displayname`** value is optional
* Example:&#x20;
  * **`/editshop additem blocks iron_block 20 2`**
* Creates an item in the blocks [shops ](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml)configuration:

```yaml
blocks:
  '23': #Index automatically generated and added to the end of the shop section's items
    material: iron_block
    buy: 20
    sell: 2
```

### Editing items:

#### Adding keys to items:

* Example:
  * **`/editshop edititem tools 12 add enchantments efficiency:3`**
* Adds an enchantment to the item at index 12 in the [shops.yml](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml#enchantments):

```yaml
tools:
  '12':
    material: iron_pickaxe
    buy: 300
    sell: 30
    enchantments:
    - efficiency:3
```

#### Modifying keys of items:

To modify a specific key on the item you will need to use the set action added in version 3.7/1.9 of the plugin.

* Example:
  * **`/editshop edititem blocks 23 set buy 123.45`**
* sets the buy price of the item at index 23 in the [shops.yml](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml#buy):

```yaml
  '23':
    material: iron_block
    buy: 123.45
    sell: 15
```

* Example:
  * **`/editshop edititem tools 12 set enchantments efficiency:3`**
  * **`/editshop edititem tools 12 add enchantments fortune:2`**
  * **`/editshop edititem tools 12 add enchantments unbreaking:5`**
* The fist command will set the whole enchantment list to efficiency 3, if there were any other enchantments before this, these will be removed.
* The following 2 commands will add the fortune and unbreaking enchantment to the list for the item inside section tools at index 12 in the [shops.yml](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml#buy):

```yaml
tools:
  '12':
    material: iron_pickaxe
    buy: 300
    sell: 30
    enchantments:
    - efficiency:3
    - fortune:2
    - unbreaking:5
```

#### Removing keys from items:

* Example:
  * **`/editshop edititem tools 12 remove enchantments efficiency:3`**
* removes enchantment efficiency 3 from the item at index 12 in the [shops.yml](https://wiki.gpplugins.com/economyshopgui/file-configuration/shops.yml#enchantments):

```yaml
tools:
  '12':
    material: iron_pickaxe
    buy: 300
    sell: 30
    enchantments:
    - fortune:2
    - unbreaking:5
```

### Deleting items:

* Command Syntax:
  * **`/editshop deleteitem <section> <itemIndex>`**
    * **`<section>:`** The section/shop category to remove this item from
    * **`<itemIndex>:`** The item index located inside the shops configuration
      * **TIP**: The item index is displayed when hovering over a shop item, the gray item lore by default.
* Example:&#x20;
  * **`/editshop deleteitem blocks page1.items.5`**

## **Cleaning the database**

Overtime the database will collect redundant amounts of player/item data which can be considered 'expired', this command allows to remove such data which will result in a faster database, and a reduced file size when using SQLite.

* **`/editshop database cleanup <dataType>`**
  * **`<dataType>`** can be replaced by ALL, PLAYER or ITEM
    * **ALL** removes both expired player and item data
    * **PLAYER** will remove only expired player data from the database
      * Player data is considered expired if the player didn't log in for the [time specified inside the config](https://wiki.gpplugins.com/economyshopgui/file-configuration/config.yml#database-cleanup)
    * **ITEM** will remove all item entries which no longer exist inside the shop
      * If a section is renamed(file name, not the name/displayname), all items that were located inside that shop will be considered expired
      * Shop items that are removed, re-located or do no longer exist by their item index inside the shop config are considered expired
