# Commands & Permissions

## 🧾 ShopMaster - Commands Reference

This section provides all available ShopMaster commands.

***

### 🛠️ Admin Commands

| Command                                                            | Description                            | Permission                |
| ------------------------------------------------------------------ | -------------------------------------- | ------------------------- |
| `/adminshop open <shop>`                                           | Opens a specific shop as admin         | `shopmaster.admin.open`   |
| `/adminshop reload`                                                | Reloads all configuration files        | `shopmaster.admin.reload` |
| `/adminshop give <player>`                                         | Gives a shop item to a player          | `shopmaster.admin.give`   |
| `/adminshop editor <shop>`                                         | Opens editor GUI for a shop            | `shopmaster.admin.edit`   |
| `/adminshop additem <shop> <slot> <buy-prece> <sell-price> <page>` | Add the item in your hand to the store | `shopmaster.item.add`     |
| `/adminshop removeitem <shop> <itemid>`                            | Removes the item by its id             | `shopmaster.item.remove`  |
| `/adminshop edititem <shop> <itemId><property> <value>`            | Edit values of an item                 | `shopmaster.item.edit`    |

> 💡 Admins can access and test shops without needing permissions configured for regular players.

***

### 🙋 User Commands

| Command        | Description                                               | Permission                   |
| -------------- | --------------------------------------------------------- | ---------------------------- |
| `/shop`        | Opens the default shop menu                               | `shopmaster.open`            |
| `/shop <shop>` | Opens a specific shop by name                             | `shopmaster.category.<shop>` |
| `/sell hand`   | Sells the item in the player's hand                       | `shopmaster.sell.hand`       |
| `/sell all`    | Sells all sellable items in inventory                     | `shopmaster.sell.all`        |
| `/sell gui`    | Sells all saleable items by placing them in an inventory. | `shopmaster.sell.gui`        |

> 🔐 You can configure separate permissions per shop using wildcard or specific permission nodes like `shopmaster.category.weapons`.

***

### ⚙️ Permission & Console Notes

* ✅ **All permissions** can be enabled, disabled, or changed from the `config.yml` file.
* 🔒 **Permission checks** can be toggled individually per command.
* 📜 **Console logging** for transactions can be customized or disabled entirely.
* 🌍 **World and gamemode restrictions** can be applied to control where commands are allowed.

Example configuration in `config.yml`:

```yaml
config:
  #Disable metrics
  metrics: true
  #Disable the message that will pop up if there is an update.
  update-checker: true

  # Transaction logging in server console
  log:
    enabled: true
    # Variables: {player}, {action} (BUY/SELL), {amount}, {item}, {money}, {shopName}
    message: "{player} {action} {amount} x {item} for {money} from {shopName} shop"

  item-sell:
    compare-meta: true         # <- Compare display name, lore and customModelData
    compare-damage: false      # <- Compare item durability (damage)
    compare-model: true        # <- Compare customModelData
    compare-all: true          # <- Use isSimilar() to compare NBT and all other data

  economy:
    # Defines the default currency symbol for the main economy (VAULT)
    default-symbol: "$"

    # Currency symbol position
    # true = symbol appears before the value ($100)
    # false = symbol appears after the value (100$)
    symbol-before: true

    # Custom symbols for different server economies
    symbols:
      vault: "$"      # Main server currency
      tokens: "✦"     # Special tokens for events or rewards
      gems: "💎"       # Gems for premium purchases
      crystals: "✧"   # Crystals for special upgrades
      points: "Pts"   # Points for rank or achievement systems

  gui:
    # Button settings to interact with the shop
    buttons:
      # Mouse buttons used to buy and sell in the GUI
      # Available options: LEFT, RIGHT, SHIFT_LEFT, SHIFT_RIGHT, MIDDLE
      buy: "LEFT"     # Button to buy items
      sell: "RIGHT"   # Button to sell items

    # Purchase/sell confirmation
    # Should a confirmation menu open before completing a transaction?
    purchase-confirmation:
      enabled: true   # true = require confirmation, false = instant transaction

    # Auto-close GUI after certain actions
    auto-close:
      on-buy: true            # Closes inventory when purchasing
      on-sell: true           # Closes inventory when selling
      on-stack-buy: true       # Closes when buying by stack (SHIFT click)
      on-sell-inventory: true

    # Handling long titles in the GUI
    truncate-titles: true       # Shorten titles exceeding max length?
    max-title-length: 36        # Max title length before shortening with (...)

  command:

    admin:
      # Enable the admin command
      # Requires server restart to apply changes
      enabled: true
      # Base command name for admins
      name: adminshop
      # Alternate command aliases that work the same
      aliases:
        - jashop

    # Command to open the main shop menu
    shop:
      # Command activation (requires server restart)
      enabled: true
      # Permission control
      need-permissions: true             # Is a specific permission required to use this command?
      permission: shopmaster.open        # Permission required if need-permissions is true
      # Command settings
      name: shop                         # Command name
      aliases: []                        # Alternate commands (empty list = no aliases)

      # Restrictions for the shop command
      black-list:
        # Worlds where the shop command is disabled
        world:
          - ExampleWorld                 # Example (replace with actual world names)
        # Game modes where the shop command is disabled
        gameModes:
          - ADVENTURE
          - CREATIVE
          - SPECTATOR

    # Command to quickly sell items
    sell:
      # Enable the sell system
      enabled: true                      # false = fully disables the /sell command
      # Permission control
      need-permissions: true             # Is permission required to use this command?
      permission: shopmaster.sell        # Permission required if need-permissions is true
      # Command settings
      name: sell                         # Command name
      aliases: []                        # Alternate commands (empty list = no aliases)

      messages:

        title:
          enabled: true
          fade-in: 10          # Ticks (1 tick = 1/20 segundos)
          stay: 40
          fade-out: 10
          title: "&a+${earnings}"
          subtitle: "&7You sold &e{amount} &7items"

        actionbar:
          enabled: true
          message: "&aYou earned &e${earnings} &afrom selling &e{amount} &aitems"

        # Message for simple sell (/sell hand)
        # Variables: {amount}, {item}, {earnings}
        simple: "&aYou sold &e{amount} x {item} &afor a total of &e${earnings}"

        # Detailed message config for multiple item sales
        summary:
          enabled: true
          show-itemized: true
          summary-text: "(summary)"
          format-items: "{amount}x {item} <gray>for <green>{earnings} <gray>(<aqua>{percent}%<gray>)"
          hover-lines:
            - "<yellow>Sale Summary:"
            - ""
            - "{format-items}"
            - ""
            - "<gray>Thanks for selling!"
          message: "<green>You sold <yellow>{total} <green>items for a total of <yellow>${earnings} {summary}"

      # Restrictions for the sell command
      black-list:
        world:
          - ExampleWorld
        gameModes:
          - ADVENTURE
          - CREATIVE
          - SPECTATOR

      # Subcommands of the sell command
      subcommands:
        # /sell all - Sells all sellable items from the inventory
        all:
          enabled: true
          need-permissions: true
          permission: shopmaster.sell.all

        # /sell hand - Sells the item in the player's hand
        hand:
          enabled: true
          need-permissions: true
          permission: shopmaster.sell.hand

        # /sell gui - Opens a GUI to add items; once closed, all items inside are sold
        gui:
          enabled: true
          show-itemized: true
          need-permissions: true
          permission: "shopmaster.sell.gui"
          default: true

  # Number and price format settings
  number-format:
    decimal-separator: "."
    grouping-separator: ","

    minimum-integer-digits: 1
    maximum-integer-digits: 32

    minimum-fraction-digits: 0
    maximum-fraction-digits: 8

    hide-fraction: true

    short-scale:
      enable-numbering: false
      limit: 1000000
      hand-decimal-limit: 2
      hand-number-limit: 32

      suffixes:
        - ""
        - "K"
        - "M"
        - "B"
        - "T"
        - "Q"

# Configuration file version (Do not modify)
file-version: 2

```

> 📘 Don't forget to reload the plugin using `/adminshop reload` after making permission or config changes.


---

# 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://docs.xshyo.us/premium-plugins/shopmaster/commands-and-permissions.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.
