# 📝UI Config

You can find all UI configs at `/plugins/SpinToWin/ui` folder. Its UI name is same as the file name in this folder. For example, `ui.yml` file's \<uiConfig> arg is `example`.

**Free version can only load 1 spin UI, premium version don't have this limit.**

<figure><img src="https://2110668471-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaYOecndMn6cJTGXy0UJU%2Fuploads%2FQCinIqIASsf3y5b7ge2v%2F2.png?alt=media&#x26;token=fad53d21-5c2c-46ab-a502-ffd3cadb8809" alt=""><figcaption></figcaption></figure>

Here is an example of UI Conigs.

```yaml
gui:
  title: ":offset_-8::s2w_ui:"
  size: 45
history-gui:
  title: ""
  dynamic-size: true
slots: [9,10,11,12,13,22,31,40,39,38,37,36,27,18]
last-reward-slot: 16

reserve: false
replace:
  material: gray_stained_glass_pane
  amount: 1
  name: "&3Acquired"
show-rate: true
frame: frame
# last-reward-times: 14

auto-settings:
  reset-timer-after-first-spin: -1
  reset-when-empty: true
  close-when-empty: true
  close-when-price-not-meet: false
  empty-amount: 1

limits:
  default: 100
  vip: 200
limits-conditions:
  vip:
    1:
      type: permission
      permission: 'group.vip'

buttons:
  spin:
    icons: [spin_1,spin_2,spin_3]
    slots: [33,34,35]
    name: "&aSpin!"
    lore:
      - "&fYou should cost %price%"
      - "&f"
      - "%click%"
  history:
    icons: [history_1,history_2,history_3]
    slots: [42,43,44]
    name: "&fHistory"
    lore:
      - "&fCheck the rewards you have drawn."
last_reward:
  material: DIAMOND_SWORD
  amount: 1
rewards:
  1:
    material: DIAMOND
    cmd: 0
    name: '&eA赏'
    lore:
      - '&fLine1'
      - '&fLine2'
    actions:
      1:
        type: console_command
        command: 'say %player% claimed A 赏!'
    amount: 10
    chance: 20
  2:
    material: IRON_INGOT
    amount: 10
    chance: 20
  3:
    material: GOLD_INGOT
    amount: 5
    chance: 10
  4:
    material: APPLE
    amount: 64
    chance: 10
  5:
    material: DIAMOND
    amount: 2
    chance: 5
  6:
    material: IRON_INGOT
    amount: 10
    chance: 20
  7:
    material: GOLD_INGOT
    amount: 5
    chance: 10
  8:
    material: APPLE
    amount: 64
    chance: 10
  9:
    material: DIAMOND
    amount: 2
    chance: 5
  10:
    material: IRON_INGOT
    amount: 10
    chance: 20
  11:
    material: GOLD_INGOT
    amount: 5
    chance: 10
  12:
    material: APPLE
    amount: 64
    chance: 10
  13:
    material: DIAMOND
    amount: 2
    chance: 5
  14:
    material: IRON_INGOT
    amount: 10
    chance: 20
prices:
  1:
    free: true
    placeholder: 'Free'
    apply: [1,2,3]
  2:
    economy-type: levels
    amount: 5
    placeholder: '5 Levels'
    apply: [1,2,3,4,5,6]
  3:
    economy-type: exp
    placeholders:
      7: '6 Exp'
      8: '7 Exp'
      9: '8 Exp'
      10: '9 Exp'
      11: '10 Exp'
    apply: [7,8,9,10,11]
    cost: [6,7,8,9,10]
  4:
    hook-plugin: EcoItems
    hook-item: super_sword
    amount: 3
    start-apply: 8

```

* gui.title: Spin UI title name.
* gui.size: Spin UI size, must be one number of `9, 18, 27, 36, 45, 54`.
* history-gui.title: History GUI title name.
* history-gui.dynamic-size: Whether history size is depand on claimed rewards amount or just same as `gui.size` value.
* slots: Reward item slots.
* reserve: Whether reward can be claimed unlimited times or only one time.
* auto-settings.empty-amount: How many reward left than we think this spin UI is empy.
* auto-settings.reset-timer-after-first-spin: How many ticks after first spin we will auto reset data, set -1 to disable this feature.
* auto-settings.reset-when-empty: Whether plugin auto reset date when this spin UI rewards all claimed.&#x20;
* auto-settings.close-when-empty: Whether plugin auto close UI when this spin UI rewards all claimed.&#x20;
* auto-settings.close-when-price-not-meet: Whether plugin auto close UI when this players are not meet next spin cost.
* replace: The item of will replaced at claimed reward item slot.
* frame: Frame name, see `config.yml`.
* show-rate: Whether to add a line of lore to the reward item to display its rate.&#x20;
* limits: Set the maximum times of spin UI. **You must enable check-permission-limit option in config.yml file to use this feature.**
* limits.default: If player dont have any required permsision, they will  use this limit.
* limits.\<Condition ID>: Players who meet this condition will use this limit. For example:

```yaml
limits:
  default: 10
  vip: 20
limits-conditions:
  vip: 
    1:
      type: permission
      permission: 'test.permission'
```

In this example, players who have test.permission permission will have 20 limits, otherwise they have only 10 limits.

* button:  Button configs.
* button.icons: Button icon name, see `config.yml`.
* last-reward: The reward what will be claimed if players has claimed all normal rewards. See [Rewards Option](https://spintowin.superiormc.cn/spin-ui/ui-config/rewards-option) for more info.
* last-reward-slot: Last reward slot.
* last-reward-times: How many spin times after will you get the last reward. If not set (*and I recommend you do not add this option*), will get last reward after you claim all rewards in a spin UI. **You must enable check-permission-limit option in config.yml to use this option.**
* rewards: List of normal rewards. See [Rewards Option](https://spintowin.superiormc.cn/spin-ui/ui-config/rewards-option) for more info.
* prices: List of prices. See [Prices Option](https://spintowin.superiormc.cn/spin-ui/ui-config/prices-option) for more info.
* For rewards and prices option: Every of them have its ID number. All ID number should be a natural number starting from 1 and incrementing by 1.&#x20;

## Custom Button

You can add more buttons as you want in your UI config, like:

```yaml
buttons:
  spin:
    icons: [spin_1,spin_2,spin_3]
    slots: [33,34,35]
    display: "&aSpin!"
    lore:
      - "&fYou should cost %price%"
      - "&f"
      - "%click%"
  history:
    icons: [history_1,history_2,history_3]
    slots: [42,43,44]
    display: "History"
    lore:
      - "&fCheck the rewards you have drawn."
  test:
    icons: [test]
    slots: [18]
    display: "Buy Key"
    lore:
      - "&fCheck here to know where can buy key."
    actions:
      1:
        type: message
        message: 'Buy spin key at https://www.example.com!' 
```

In this example, we added test as new button.

* icons: Should be added in config.yml, in this example, we added test icon in config.yml, like:

```yaml
icon:
  history_3: 70000
  spin_1: 70001
  spin_2: 70002
  history_2: 70003
  spin_3: 70004
  history_1: 70005
  test: 10000
```

* slots: Should be one of 9\~54 number, 0\~8 is forbidden.
* actions: The action will execute after click this button. Use **Action Format** here, for more info, please view [this page](https://spintowin.superiormc.cn/info/format).
