forked from nisovin/MagicSpells
-
Notifications
You must be signed in to change notification settings - Fork 72
AnvilInputSpell
JasperLorelai edited this page Jul 19, 2026
·
1 revision
spell-class: ".targeted.AnvilInputSpell"Important
Since 4.0 Beta 19.
| Value | Supported |
|---|---|
entity |
true |
location |
false |
entity_from_location |
false |
Instant spell, which opens an anvil view for a player, awaiting user input. If the anvil result item is clicked, the "rename text" of the item is stored in a variable. The config can compare against an initial value during spell-on-close cast to know if a new value was submitted (see Example). The menu is closed on plugin reload.
Some of these options support dynamic values through numeric or string expressions.
| Option | Description | Type | Supports expressions |
|---|---|---|---|
title |
Rich Text | true |
|
variable-name |
String Variable name | false |
|
spell-on-close |
Cast whenever the menu is closed, including when the player quits the server. Menus are closed on plugin reload, so this spell is cast then too. | Sub-spell | false |
variables:
user_name:
type: playerstring
user_input:
spell-class: ".instant.AnvilInputSpell"
always-granted: true
title: "Enter your name:"
variable-name: user_name
spell-on-close: user_input_process
variable-mods-cast: [user_name =null]
user_input_process:
spell-class: ".instant.DummySpell"
helper-spell: true
modifiers: [variable user_name=null deny]
str-cast-self: "Your new name is: %var:user_name%"