-
Notifications
You must be signed in to change notification settings - Fork 1
GUI Configuration
This guide explains creating and editing GUIs
These options define the GUI used and what settings are applied to it
{ "title": "<dark_gray>Example GUI", "size": 3, "items": {} }
The message displayed at the top of the GUI. Uses MiniMessage formatting!
"title": "<dark_gray>Example Title"
The number of rows the GUI should contain. Integer value between 1
and 6
.
"size": 3
A MAP of items to display. Each entry needs its unique string identifier. See the Items section below.
"items": {}
A list of commands that can be used to access this GUI. Each entry is a new command, which should only be one word and unused by another mod. A restart is required to register commands!
"alias_commands": [ "example" ]
A list of Actions that are executed when the GUI is opened. Any Open Requirements must succeed before any actions are executed. Each action can have Requirements defined that must also succeed before each actions is executed. See Actions for more information.
"open_actions": { "action_1": { "type": "COMMAND_CONSOLE", "click": "ANY", "commands": ["give %player% diamond 1"] }, "action_2": { "type": "MESSAGE", "click": "ANY", "message": ["<blue>Thanks for opening my menu!"] } }
A list of Actions that are executed when the GUI is closed. Each action can have Requirements defined that must also succeed before each actions is executed. See Actions for more information.
"close_actions": { "action_1": { "type": "COMMAND_CONSOLE", "click": "ANY", "commands": ["give %player% diamond_sword 1"] }, "action_2": { "type": "MESSAGE", "click": "ANY", "message": ["<red>Sad to see you go. Take this for the road!"] } }
Define requirements that must be met before a GUI can be opened. Optionally, Actions can be defined to execute when the requirements have failed or succeeded. See Requirements for more information on requirements.
"view_requirements": { "requirements": { "example_requirement_1": { "type": "PERMISSION", "permission": "test.permission" } }, "deny_actions": { "deny_action_1": { "type": "MESSAGE", "message": ["<red>You do not have permission!"] } }, "success_actions": { "success_action_1": { "type": "MESSAGE", "message": ["<green>You do have permission!"] } } },
Items define what the GUI contains and how they behave when interacting with them.
{
"title": "<dark_gray>Example GUI",
"size": 3,
"items": {
"item_1": {
"item": "minecraft:diamond_sword",
"slots": [0],
"count": 1,
"name": "<blue><b>Example Sword",
"lore": ["<gray><italic>Example lore!"],
"nbt": {
"Enchantments": [
{
"lvl": 3,
"id": "minecraft:unbreaking"
}
],
"HideFlags": 1
},
"priority": 1,
"view_requirements": {
"requirements": {
"requirement_1": {
"type": "PERMISSION",
"permission": "test.permission"
}
},
"success_actions": {},
"deny_actions": {}
},
"click_requirements": {
"requirements": {
"requirement_1": {
"type": "PERMISSION",
"permission": "test.permission.2"
}
},
"success_actions": {},
"deny_actions": {}
},
"actions": {
"action_1": {
"type": "COMMAND_CONSOLE",
"click": "ANY",
"commands": ["give %player% diamond_sword 1"]
},
"action_2": {
"type": "MESSAGE",
"click": "ANY",
"message": ["<blue>You have received the Example Sword!"]
}
}
}
}
}
An item identifier (combination of modid:itemid
). This can be any item, vanilla or modded. Unknown item stacks will default to minecraft:air
.
"item": "minecraft:stone"
A list of slots that this item will be inserted into. This value should be between 0
and the (size
* 9) - 1. EX: if "size: 3"
, then between 0
and 26
. Defaults to an empty list if not provided.
"slots": [0, 1, 7, 8]
The amount of this item that should be displayed in each slot. Defaults to 1 if not provided.
"amount": 10
The name to override the item with. Defaults to the item's normal name if not provided. Uses MiniMessage formatting!
"name": "<red>Example Stone"
A list of lore to override the item with. Defaults to an empty list if not provided. Uses MiniMessage formatting!
"lore": [ "<gray>Example Line 1", "<gray>Example Line 2" ]
An NBT Compound that is set onto the item. This follows the same formatting as applying NBT to an item via /give
. No additional NBT is applied if not provided.
"nbt": { "Enchantments": [ { "lvl": 3, "id": "minecraft:unbreaking" } ], "HideFlags": 1 }
The priority of this item to the defined slots compared to other items. The closer to 0, the higher the priority. Useful in combination with View Requirements to display different items using conditionals. Defaults to 0 if not provided.
"priority": 10
Define when an item is allowed to be displayed using conditionals. All listed requirements must be met in order for the item to be displayed. Useful in combination with Priority to display different items using conditionals. Optionally, Actions can be defined to execute when the requirements have failed or succeeded. See Requirements for more information on requirements.
"view_requirements": { "requirements": { "example_requirement_1": { "type": "PERMISSION", "permission": "test.permission" } }, "deny_actions": { "deny_action_1": { "type": "MESSAGE", "message": ["<red>You do not have permission!"] } }, "success_actions": { "success_action_1": { "type": "MESSAGE", "message": ["<green>You do have permission!"] } } },
A list of Actions that are executed when the item is clicked on. The Click Type must be correct and any Click Requirements defined must succeed before the actions are executed. See Actions for more information.
"click_actions": { "action_1": { "type": "COMMAND_CONSOLE", "click": "ANY", "commands": ["give %player% diamond_sword 1"] }, "action_2": { "type": "MESSAGE", "click": "ANY", "message": ["<blue>You have received the Example Sword!"] } }
Define when an item's actions are allowed to be executed when clicked on using conditionals. All listed requirements must be met in order for any actions to be ran or checked. Optionally, Actions can be defined to execute when the requirements have failed or succeeded. See Requirements for more information on requirements.
"click_requirements": { "requirements": { "example_requirement_1": { "type": "PERMISSION", "permission": "test.permission" } }, "deny_actions": { "deny_action_1": { "type": "MESSAGE", "message": ["<red>You do not have permission!"] } }, "success_actions": { "success_action_1": { "type": "MESSAGE", "message": ["<green>You do have permission!"] } } },
Actions are a list of well, actions, that are executed either when an item is clicked on (and the Click Type is correct), a GUI is opened/closed, or a Requirement has failed/succeeded, depending on where they are defined. A list of requirements can be defined that will be checked before the action can be ran. Additionally, chance and delay values can be defined to add odds of successful execution or delaying the execution, respectively. Each entry in each actions section must have a unique string identifier. See Action Types for the types and additonal options.
"actions": { "action_1": { "type": "COMMAND_CONSOLE", "click": "ANY", "commands": ["give %player% diamond_sword 1"] }, "action_2": { "type": "MESSAGE", "click": "ANY", "message": ["<blue>You have received the Example Sword!"] }, "action_3": { "type": "COMMAND_CONSOLE", "click": "ANY", "commands": ["give %player% diamond 1"], "requirements": { "requirements": { "type": "PERMISSION", "permission": "test.permission" } } }, "chance_action_1": { "type": "MESSAGE", "click": "ANY", "chance": 0.5, "message": ["<gold>This is a RARE message!"] }, "delayed_action_1": { "type": "MESSAGE", "click": "ANY", "delay": 100, "message": ["<blue>You received the Example Sword 5 seconds ago!"] } }
The type of action that this entry is. Must be in full capitalization. A list of types can be found in Action Types.
"type": "MESSAGE"
The type of click that is required for this action to execute. Must be in full capitalization. A list of types can be found in Click Types. Defaults to ANY if not provided.
"click": "ANY"
The time in ticks (20 ticks a second) until the action should be executed. Defaults to 0 (no delay) if not provided.
"delay": 100
The chance that this action should be executed. Allowed values are between 0.0
and 1.0
. An example of a 50% chance would be 0.5
. Defaults to no chance check if not provided.
"chance": 0.5
Define when an action is allowed to execute using conditionals. All listed requirements must be met in order for the action to be ran. The Click Type must be correct before the requirement will be checked. Optionally, Actions can be defined to execute when the requirements have failed or succeeded. See Requirements for more information on requirements.
"requirements": { "requirements": { "example_requirement_1": { "type": "PERMISSION", "permission": "test.permission" }, }, "deny_actions": { "deny_action_1": { "type": "MESSAGE", "message": ["<red>You do not have permission!"] } }, "success_actions": { "success_action_1": { "type": "MESSAGE", "message": ["<green>You do have permission!"] } } },
Additional options are available depending on the type of action used. See Action Types for each type's additional options.
Identifier | Description | Options |
---|---|---|
MESSAGE | Send a message to the player | "message": [ |
COMMAND_CONSOLE | Run a command as the console | "commands": [ |
COMMAND_PLAYER | Run a command as the player | "commands": [ |
BROADCAST | Broadcast a message to all players | "message": [ |
PLAYSOUND | Play a sound to the player | "sound": "<sound identifier>", |
OPEN_GUI | Open a GUI for the player | "id": "<gui id>" |
CLOSE_GUI | Close this GUI for the player | None |
REFRESH_GUI | Refresh the player's current GUI | None |
GIVE_XP | Give XP to the player | "amount": "<int>", |
CURRENCY_DEPOSIT | Deposit currency from a player's account | "amount": "<amount>", |
CURRENCY_WITHDRAW | Withdraw currency from a player's account | "amount": "<amount>", |
CURRENCY_SET | Set the balance of a player's account | "amount": "<amount>", |
GIVE_ITEM | Give the player an item | "item": "<item identifier>", |
TAKE_ITEM | Take an item from the player if possible. Strict will define if NBT needs to be exact | "item": "<item identifier>", |
Identifier | Left Click | Shift Left Click | Right Click | Shift Right Click | Middle Click | Throw (Q) |
---|---|---|---|---|---|---|
ANY | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ |
LEFT_CLICK | ☑ | ☐ | ☐ | ☐ | ☐ | ☐ |
SHIFT_LEFT_CLICK | ☐ | ☑ | ☐ | ☐ | ☐ | ☐ |
ANY_LEFT_CLICK | ☑ | ☑ | ☐ | ☐ | ☐ | ☐ |
RIGHT_CLICK | ☐ | ☐ | ☑ | ☐ | ☐ | ☐ |
SHIFT_RIGHT_CLICK | ☐ | ☐ | ☐ | ☑ | ☐ | ☐ |
ANY_RIGHT_CLICK | ☐ | ☐ | ☑ | ☑ | ☐ | ☐ |
ANY_CLICK | ☑ | ☑ | ☑ | ☑ | ☐ | ☐ |
ANY_MAIN_CLICK | ☑ | ☐ | ☑ | ☐ | ☐ | ☐ |
ANY_SHIFT_CLICK | ☐ | ☑ | ☐ | ☑ | ☐ | ☐ |
MIDDLE_CLICK | ☐ | ☐ | ☐ | ☐ | ☑ | ☐ |
THROW | ☐ | ☐ | ☐ | ☐ | ☐ | ☑ |
Requirements are a list of checks that must succeed for a GUI to open, Item to display, or Action to activate, depending on where it's used. A MAP of requirements must be listed that are checked when activated. A list of deny and success actions can then be defined that will activate when any requirement has failed or all have succeeded, respectively. Each entry in the requirements section must have a unique string identifier. See Requirement Types for the types and additonal options.
"<type>_requirements": { "requirements": { "example_requirement_1": { "type": "PERMISSION", "permission": "test.permission" }, }, "deny_actions": { "deny_action_1": { "type": "MESSAGE", "message": ["<red>You do not have permission!"] } }, "success_actions": { "success_action_1": { "type": "MESSAGE", "message": ["<green>You do have permission!"] } } },
The type of action that this entry is. Must be in full capitalization. A list of types can be found in Action Types.
"type": "MESSAGE"
The type of comparison that this requirement should do. The usage changes depending on the requirement used. See Comparison Types for more information. Defaults to == (equals) if not provided.
"comparison": "=="
Additional options are available depending on the type of action used. See Action Types for each type's additional options.
A MAP of actions that are performed when any requirement has failed. Each entry needs its unique string identifier. See Actions for more information.
"deny_actions": { "deny_action_1": { "type": "MESSAGE", "message": ["<red>You do not have permission!"] } },
A MAP of actions that are performed when all requirements has succeeded. Each entry needs its unique string identifier. See Actions for more information.
"success_actions": { "success_action_1": { "type": "MESSAGE", "message": ["<green>You do have permission!"] } },
Identifier | Description | Options |
---|---|---|
PERMISSION | Check if the player has a permission | "permission": "<permission.node>" |
ITEM | Check if the player has an item. Strict will define if NBT needs to be exact | "item": "<item identifier>", |
CURRENCY | Check if the player has an amount of currency | "amount": "<amount>", |
PLACEHOLDER | An input string will be parsed and checked against an output string. Strict will define if capitalization needs to be exact | "input": "<string>", |
JAVASCRIPT | An expression string will be parsed and then evaluated by the GraalVM JavaScript engine. The expression should return a boolean value | "expression": "<string>" |
DIMENSION | Check if the player is in a dimension | "id": "<mod:id>" |
PLAN_PLAYTIME | Check the player's playtime. Requires the Plan mod. | "time": "<seconds>" |
Identifier | PERMISSION/DIMENSION | ITEM/CURRENCY | PLACEHOLDER | JAVASCRIPT |
---|---|---|---|---|
== | Returns equality check | Has exactly "amount"
|
Input matches Output | Expression returns true |
!= | Returns opposite of equality check | Does not have exactly "amount"
|
Input does not match Output | Expression returns false |
> | Has greater than "amount"
|
|||
< | Has less than "amount"
|
|||
>= | Has greater than or equal to "amount"
|
|||
<= | Has less than or equal to "amount"
|