Skip to content
AfkF24 edited this page Apr 24, 2023 · 29 revisions

Each GUI uses an entire YAML file to parse its settings from the guis -> <lang> folder.
Unlike language files, they don't automatically add new options since they're 100% customizable.

How to read this documentation?

Main Options

title: Text # The title displayed above the GUI.
rows: Number ; 1 - 6 # The amount of rows that this GUI will have. The columns will have a fixed size of 9
type: Text # If no rows is specified, a type will be used. You can see all the types here:
           # https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryType.html
message: Text # Message that the player receives when this GUI opens.
disallow-creative: Boolean # Whether this GUI can be opened in creative mode or not.
interactable: [Number] or 'empty' # Interactable slots of this GUI. If it only contains one slot and that number is lower than zero,
            # then the list will act as a blacklist.
            # When set to "empty" all slots that don't have an option defined for them will be interactable. Meaning even if you did put
            # an item in one of these slots, that slot is no longer empty, but it's still "empty" in the sense that it has no option for that slot.

Item Options

These options are used under the item names which are under options entry of GUIs. Option names are really important for some GUIs. They define what an option does from the code. If an option name doesn't have any actions attached to it, it'll not do anything when clicked on. This is where conditional GUIs come to use.
All the text options in items support color codes and placeholders.
Some people might find the following information hard to understand. If you have a question for any options below, ask me.

For the general options used to create items which is even used outside of GUIs, refer to this documentation.

Other options that are specific to GUIs:

condition: Text # Refer to the section below for more information.
sound: Sound # The sound played when this item is clicked.
commands: [Command] # The commands executed when this item is clicked.
message: Text # The message sent to the player when this item is clicked.
interaction: GUIInteractionType # How should the plugin behave when a player interacts with this item in the GUI?

alias GUIInteractionType: for Text 
  DISALLOW  # The default interaction type. Doesn't allow the player to click on the item in any way.
  FREE      # The player can manipulate this slot freely. Take the item, and put new items in it.
  TAKE_ONLY # The player can only take the item that was put by the GUI from this slot.

# The position(s) of the item.
slot:   Number  ; 0 - 53
slots: [Number] ; 0 - 53 # When this option is used, the same item will be placed in multiple slots.
posx:   Number  ; 1 - 9
posy:   Number  ; 1 - 6

perform-action: Boolean # If the option has special meaning, then when this option is set (it's intended to be set to "false" but any value works),
                        # then it'll act like other decorative option. Meaning when clicked on, it'll do nothing.

alias Sound:   for Text # https://github.com/CryptoMorin/KingdomsX/wiki/Config
alias Command: for Text # https://github.com/CryptoMorin/KingdomsX/wiki/Config

Conditional

GUI items use a simple logical-relational evaluator to change item appearance depending on a condition. You can define certain item properties by using condition option and putting each under a custom condition name. These conditions follow the general config conditions rules.

Example:

options:
  hello:

    # Options defined outside of conditional options are inherited. This only works for general options such as name, lore, material etc.
    # if a GUI defines special options for certain options, those will not be inherited.
    # So for example if the lore doesn't change in below situations,
    # you can write it here once instead of writing it twice or more.
    lore: "This option disables\nsomething somewhere"
   
    # Note that "activated" and "else" are just normal names that have no effects.
    # The last condition which is always used if none of the conditions above it were met, is named "else" most of the times.
    activated:
      condition: "kingdoms_members > 10 && kingdoms_members < 20"
      name: "&2Activated"
      material: GREEN_WOOL
    else: # You should use this name as well, it might be problematic in future versions.
      # Note that there's no "condition" option here. There is no need for us to use "%kingdoms_members% <= 10" here.
      # Omitting the condition will automatically default to always match.
      name: "&4Disabled"
      material: RED_WOOL

If you're looking for something similar, but for math equations, you should search for Conditional functions in the config section.

Custom UI

You can change the overall layout of each GUI by using ItemsAdder plugin. You can refer to this guide that explains how this works. You can use the placeholders inside the title option of each GUI.

If your GUI's image is a bit off (not centered on the screen), first try removing the offset completely. If it didn't work, try setting a high number to offset like -10 so you can see the title underneath. If the title has weird characters like or that means you have to regenerate your pack. If that didn't work, try clearing your cache with /iacleancache command.

Note Make sure you're using the latest version of ItemsAdder. The weird characters are usually caused by versions older than v3.3.0