MenuSpell - TheComputerGeek2/MagicSpells GitHub Wiki
This spell extends its options from Instant Spell.
spell-class: ".MenuSpell"
-
special
- Plays the effect at the caster's location when they open a menu.
Value | Supported |
---|---|
entity |
true |
location |
true |
entity_from_location |
false |
A spell that opens an inventory GUI with options.
Since 4.0 Beta 13 some of these options support dynamic values through numeric or string expressions.
Option | Description | Type | Default | Supports expressions |
---|---|---|---|---|
title |
The title of the menu. Supports variable replacement. | Rich Text | "Window Title <spellName>" |
true |
delay |
Delays the open event by server ticks. You should set this to at least 1 when chaining menu spells. | Delay | 0 |
true |
require-entity-target |
If set to true targets entities to cast a spell on. | Boolean | false |
true |
require-location-target |
If set to true target locations to cast the spell at. | Boolean | false |
true |
target-opens-menu-instead |
If set to true, open the GUI for the targeted entity if require-entity-target is true. |
Boolean | false |
true |
bypass-normal-cast |
If set to false, all sub-spells in all options will not be cast as a sub-spell, but as a main spell. By default, sub-spells are cast in partial mode, ignoring cooldowns and other things listed. Using this spell option ignores all other cast arguments, and it is the equivalent of configuring all sub-spells to be cast in full mode. | Boolean | true |
true |
filler |
An item to fill slots without items. Uses the Magic Item String format. | String | false |
|
stay-open-non-option |
If set to true, when empty slots or fillers are clicked, the menu will stay open. | Boolean | false |
true |
min-rows |
The spell usually resizes the GUI to fit in all options. You can alternatively set a minimum amount of set rows. | Integer | 0 |
true |
options |
A config section with keys that may be random, and values which follow Menu Option configuration. | Config Section |
Option | Description |
---|---|
slot |
The slot to put this item in. The latest will override the previous item if two items have the same slot. Option modifiers can control this and have a specific item appear based on the condition. |
slots |
A list of slots to put the item in. The behaviour is the same as above. If both slot and slots are defined, slot will be ignored. |
item |
Magic item to display. Can be in string format using the Magic Item String or Magic Item Config format. Custom name and lore support variable replacement. |
items |
List of magic items, using the Magic Item String format, to pick one random item from. If this is defined, it will ignore item . |
quantity |
Quantity of the specified item . This can be a variable name. |
modifiers |
Modifiers which determine whether the item is displayed in the slot. |
spell |
Sub-spell cast if the item is left clicked. |
spell-right |
Sub-spell cast if the item is right clicked. |
spell-middle |
Removed in 4.0 Beta 13. Undetectable unless in Creative mode since around 1.18. Sub-spell cast if the item is middle mouse clicked. |
spell-sneak-left |
Sub-spell cast if the item is left clicked while sneaking. |
spell-sneak-right |
Sub-spell cast if the item is right clicked while sneaking. |
spell-drop |
Since 4.0 Beta 13. Sub-spell cast if the item is dropped with the drop key. |
spell-swap |
Since 4.0 Beta 13. Sub-spell cast if the item is swapped offhand with the swap key. |
power |
The spell power of the clicked spell. |
stay-open |
Defaults to false . Determines whether the menu should stay open when an item is clicked. The menu is reopened (refreshed) if the item is clicked cast a spell that was cast successfully. If it doesn't cast successfully, it doesn't close the menu. |
Menu:
spell-class: ".MenuSpell"
cooldown: 2
bypass-normal-cast: false
options: # You can have more than one defined option
option1: # The name of the option can be anything
slot: 0 # The first slot starts from 0 to 53
item: stone
quantity: 64
stay-open: false
option2:
slot: 1
item: stone
quantity: 32
stay-open: true # Leave the menu open if you select this
CoordsMenu: # A simple example yet a great way to use variable replacement in a MenuSpell
spell-class: ".MenuSpell"
cast-item: compass
title: "&4This GUI shows your coordinates!"
options:
coordinates:
slot: 1
item: # In this case the item option is a configuration section
type: compass
name: "&7&lCoordinates"
lore:
- "&9You are now at..."
- "&cX: &4%var:meta_location_x:0% &cY: &4%var:meta_location_y:0% &cZ: &4%var:meta_location_z:0%"
stay-open: true
bedcordinates:
slot: 7
item:
type: bed
name: "&b&lBed Coordinates"
lore:
- "&9You are now at..."
- "&cX: &4%var:meta_bed_location_x:0% &cY: &4%var:meta_bed_location_y:0% &cZ: &4%var:meta_bed_location_z:0%"
stay-open: true