-
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.
If your conditional GUI options are not changing that means your Java version is JRE instead of JDK.
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] # 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.
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.
-
sound:
The sound played when this item is clicked. -
commands:
The commands executed when this item is clicked. -
message:
The message sent to the player when this item is clicked. -
can-take:
true or false. If this item can be taken out of the GUI by the player. -
slots/posx,posy/slot:
The position(s) of the item. When usingslot
, you need to count the slots of the GUI from top to bottom and left to right and then subtract that number by one. When usingposx
andposy
You just need to know the exact position in the GUI. When usingslots
it's the same asslot
, but you can put the item in multiple slots with the same properties and actions.slots: [34, 35, 36, 37]
GUI items use a simple logical-relational evaluator to change item appearance depending on a condition.
You can change the entire item property by using condition
option and putting each under a custom condition name. You can also use conditions for sounds, slots and messages.
Currently this evaluator only supports numbers.
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. |
Example:
options:
hello:
# 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:
# We use true here because if the previous condition wasn't met,
# there is no need for us to use "%kingdoms_members% <= 10" here.
condition: true
name: "&4Disabled"
material: RED_WOOL
sound:
"%kingdoms_members% <= 5": BLOCK_ANVIL_FALL
"true": BLOCK_ANVIL_BREAK
Terminology - Spigot - Discord