-
Notifications
You must be signed in to change notification settings - Fork 58
GUIs
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 their 100% customizable.
How to read this documentation?
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.
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
GUI items use a simple logical-relational evaluator to change item appearance depending on a condition.
You can certain item properties by using condition
option and putting each under a custom condition name.
Supported operations:
Symbol | Description |
---|---|
! |
Negation. E.g. !test will be false if test is true and vice versa. |
== |
Checks if two numbers are equal. |
!= |
Checks if two numbers are not equal. |
> |
Checks if a number is greater than a number. |
< |
Checks if a number is less than a number. |
>= |
Checks if a number is greater than or equals to a number. |
<= |
Checks if a number is less than or equal to a number. |
&& |
Checks if both conditions are true. |
|| |
Checks if either conditions are true. |
Condition options support placeholders of course, but just like math equations, you have to omit the %
s when writing them.
All conditional options also support a special placeholder that checks whether the player has a permission. The format is perm_<permission>
where <permission>
is the same as the permission text that you use in permission plugins, but instead of being separated by dots, they're separated by underscores. E.g. kingdoms.command.show
would be perm_kingdoms_command_show
and just like all the other placeholders in condition options, this one doesn't need to be surrounded by %
s either.
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.
Terminology - Spigot - Discord