Skip to content
JasperLorelai edited this page May 19, 2024 · 15 revisions

Source Code

spell-class: ".targeted.ConversationSpell"
Value Supported
entity true
location false
entity_from_location false

Description:

Opens a chat prompt that can be used to store the target's response in a variable. This is a targeted spell, so remember to use target-self: true to capture the caster's response instead.

Configuration:

Option Description
conversation Starts a section with a number of options. Will fail if not defined.

Conversation Options:

Option Description Type
prefix Accepts a string. String
local-echo Whether or not to let the player see their responses in chat. Boolean
timeout-seconds The amount of time until the conversation automatically closes. Integer
escape-sequence The string (in quotes) the player can send to exit the conversation spell. String
first-prompt Name is misleading - you can only have one prompt. Starts a section with a number of options. Will fail if not defined. Prompt Options

Prompt Options:

Option Description
prompt-type Accepts the values regex, fixed-set, or enum.
prompt-text Accepts a string. The message that will be sent to the player upon the spell being cast.
variable-name The variable to save the response to.

Expand that same section with the prompt type's specific options. For:

  • regex - add regexp option which accepts a valid RegExp string.
  • fixed-set - add an options string list for valid expected responses.
  • enum - add enum-class string with the full qualified class name of an enum. For example, limit valid responses to Paper's potion effect types by setting the string to the package and class name: org.bukkit.potion.PotionEffectType.

Example:

variables:
    varMagicUserResponse:
        type: playerstring

Conversation:
    spell-class: ".targeted.ConversationSpell"
    target-self: true
    conversation:
        prefix: "&3&l[&bQuest&3&l] &7"
        local-echo: true
        first-prompt:
            prompt-type: fixed-set
            prompt-text: |
                Are you a magic user? Can you help me?
                &3Do you want to accept this quest? §bType your response!
                &7- &aYes
                &7- &cNo
            options:
                - "Yes"
                - "No"
            variable-name: varMagicUserResponse
        timeout-seconds: 6
        escape-sequence: "Exit"
Clone this wiki locally