AnvilInputSpell - TheComputerGeek2/MagicSpells GitHub Wiki
spell-class: ".targeted.AnvilInputSpell"
[!IMPORTANT] Since 4.0 Beta 19.
targeting cast argument values:
| Value | Supported |
|---|---|
entity |
true |
location |
false |
entity_from_location |
false |
Description:
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.
Configuration:
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 |
Example:
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%"