Code (YAML):
# =============================================================================
# PlayerInput Format Configuration
# =============================================================================
# This file contains all predefined input formats for the PlayerInput plugin.
# Each format defines how players will be prompted for input and how that input
# will be validated.
#
# FORMAT STRUCTURE:
# format_name:
# timeout: 30 # Time in seconds to wait for player input
# validation:
# type: STRING|INTEGER|DECIMAL # Type of validation to perform
# rules: # List of validation rules (all optional)
# - "length: min;max" # For STRING: length between min and max
# - "contains: text" # For STRING: must contain specific text
# - "contains: /regex/" # For STRING: must match regex pattern
# - "contains: text1 or text2" # For STRING: must contain text1 OR text2
# - "contains: text1 and text2" # For STRING: must contain text1 AND text2
# - "contains: /regex1/ and /regex2/" # For STRING: must match regex1 AND regex2
# - "value_range: min;max" # For INTEGER/DECIMAL: value between min and max
# actions: # List of actions to execute when input starts
# - "send_message: text" # Send chat message to player
# - "send_title: title;subtitle;fadeIn;stay;fadeOut" # Send title
# - "send_actionbar: text;duration" # Send actionbar message
# - "wait: ticks" # Wait for specified ticks (20 ticks = 1 second)
# - "play_sound: SOUND;volume;pitch" # Play sound effect
# success: # Configuration for successful input
# message: "message" # Message sent when input is valid (optional, uses default from config.yml)
# sound: "SOUND;volume;pitch" # Sound played when input is valid (optional)
# command: "command" # Command executed when input is valid (optional, executed as console)
# fail: # Configuration for invalid input
# message: "message" # Message sent when input is invalid (optional, uses default from config.yml)
# sound: "SOUND;volume;pitch" # Sound played when input is invalid (optional)
# command: "command" # Command executed when input is invalid (optional, executed as console)
# timeout: # Configuration for timed out sessions
# message: "message" # Message sent when session times out (optional, uses default from config.yml)
# sound: "SOUND;volume;pitch" # Sound played when session times out (optional)
# command: "command" # Command executed when session times out (optional, executed as console)
#
# PLACEHOLDERS in success/fail messages:
# {player} - Player name
# {input} - The input value the player entered
#
# =============================================================================
# REGEX SUPPORT
# =============================================================================
# Regular expressions (regex) are powerful patterns for matching text.
# In PlayerInput, you can use regex in "contains" rules.
#
# For a comprehensive regex tutorial, visit:
# https://www.regular-expressions.info/quickstart.html
#
# TIP: Always test your regex patterns before using them in production!
# You can test them here: https://regex101.com/
#
# =============================================================================
formats
:
# Example: Simple text input
text_input:
timeout
: 30
validation:
type
: STRING
rules:
- "length
: 1;100
"
- "contains
: hello
"
actions:
- "send_message
:
&ePlease enter your text:
"
- "send_title
:
&6Text Input Required;&7Type your response in chat;10;70;20
"
- "send_actionbar
:
&aWaiting for text input
...;100
"
success:
message: "&aText received
:
{input
}
"
sound: "BLOCK_NOTE_BLOCK_PLING;1.0;1.2
"
command: "say Player
{player
} submitted text
:
{input
}
"
fail:
message: "&cInvalid text format! Please try again.
"
sound: "
none
"
command: "
none
"
timeout:
message: "&cText input session timed out!
"
sound: "ENTITY_ENDERMAN_TELEPORT;1.0;0.5
"
command: "
none
"
# Example: Number input
number_input:
timeout: 30
validation:
type: INTEGER
rules:
- "value_range
: 0;1000
"
actions:
- "send_message
:
&ePlease enter a number:
"
- "send_title
:
&6Number Input Required;&7Enter a valid number;10;70;20
"
- "send_actionbar
:
&aWaiting for number input
...;100
"
success:
message: "&aNumber
{input
} received successfully!
"
sound: "ENTITY_EXPERIENCE_ORB_PICKUP;1.0;1.0
"
command: "give
{player
} diamond
{input
}
"
fail:
message: "&cPlease enter a number between 0 and 1000.
"
sound: "BLOCK_NOTE_BLOCK_BASS;1.0;0.5
"
command: "
none
"
timeout:
message: "&cNumber input session timed out!
"
sound: "
none
"
command: "
none
"
# Example: Decimal input
decimal_input:
timeout: 30
validation:
type: DECIMAL
rules:
- "value_range
: 0.0;100.0
"
actions:
- "send_message
:
&ePlease enter a decimal number:
"
- "send_title
:
&6Decimal Input Required;&7Enter a valid decimal number;10;70;20
"
- "send_actionbar
:
&aWaiting for decimal input
...;100
"
success:
message: "&aDecimal value
{input
} accepted!
"
sound: "BLOCK_NOTE_BLOCK_CHIME;1.0;1.0
"
command: "
none
"
fail:
message: "&cPlease enter a decimal number between 0.0 and 100.0.
"
sound: "ENTITY_ITEM_BREAK;1.0;1.0
"
command: "
none
"
timeout:
message: "&cDecimal input session timed out!
"
sound: "
none
"
command: "
none
"
# Example: Simple yes/no input
yes_no_input:
timeout: 30
validation:
type: STRING
rules:
- "contains
:
yes or
no
"
actions:
- "send_message
:
&ePlease enter '
yes' or '
no':
"
- "send_title
:
&6Yes/No Input Required;&7Type '
yes' or '
no';10;70;20
"
- "send_actionbar
:
&aWaiting for
yes/
no input
...;100
"
success:
message: "&aResponse '
{input
}' recorded!
"
sound: "ENTITY_PLAYER_LEVELUP;1.0;1.0
"
command: "say
{player
} answered
:
{input
}
"
fail:
message: "&cPlease enter '
yes' or '
no' only.
"
sound: "ENTITY_ENDERMAN_TELEPORT;1.0;0.5
"
timeout:
message: "&cYes/
No input session timed out!
"
sound: "ENTITY_ENDERMAN_TELEPORT;1.0;0.5
"
# Example: Minecraft username validation with regex
username_input:
timeout: 30
validation:
type: STRING
rules:
- "length
: 3;16
"
- "contains
: /^
[a-zA-Z0-9_
]+$/
" #Regex that allows only letters, numbers and underscores
actions:
- "send_message
:
&ePlease enter your desired username:
"
- "send_title
:
&6Username Required;&7Enter a valid Minecraft username;10;70;20
"
- "send_actionbar
:
&aWaiting for username input
...;100
"
success:
message: "&aUsername '
{input
}' is valid and has been saved!
"
sound: "ENTITY_FIREWORK_ROCKET_BLAST;1.0;1.0
"
command: "lp user
{player
} meta setprefix &7
[
{input
}
]
"
fail:
message: "&cInvalid username! Must be 3-16 characters, letters, numbers, and underscores only.
"
sound: "ENTITY_GHAST_SCREAM;1.0;1.0
"
timeout:
message: "&cUsername input session timed out!
"
sound: "ENTITY_ENDERMAN_TELEPORT;1.0;0.5
"
# Example: Multiple choice input with OR operator
color_choice:
timeout: 30
validation:
type: STRING
rules:
- "contains
: red or blue or green or yellow
"
actions:
- "send_message
:
&ePlease choose a color
(red, blue, green, or yellow
):
"
- "send_title
:
&6Color Choice;&7Pick your favorite color;10;70;20
"
- "send_actionbar
:
&aWaiting for color choice
...;100
"
success:
message: "&aYou chose
:
{input
}
"
sound: "BLOCK_NOTE_BLOCK_PLING;1.0;1.2
"
command: "give
{player
}
{input
}_wool 1
"
fail:
message: "&cPlease choose from
: red, blue, green, or yellow
"
sound: "ENTITY_VILLAGER_NO;1.0;0.8
"
timeout:
message: "&cColor choice session timed out!
"
sound: "ENTITY_ENDERMAN_TELEPORT;1.0;0.5
"
# Example: Complex validation with AND operator
secure_password:
timeout: 30
validation:
type: STRING
rules:
- "length
: 8;50
"
- "contains
: /
[A-Z
]/ and /
[a-z
]/ and /
[0-9
]/ and /
[!@
#$%^&*_]/" #Regex that allows only uppercase, lowercase, number, and special character
actions:
- "send_message
:
&ePlease enter a secure password:
"
- "send_title
:
&6Password Required;&7Must contain uppercase, lowercase, number, and special character;10;70;20
"
- "send_actionbar
:
&aWaiting for password input
...;100
"
success:
message: "&aPassword set successfully!
"
sound: "ENTITY_PLAYER_LEVELUP;1.0;1.0
"
command: "say
{player
} has set a secure password
"
fail:
message: "&cPassword must be 8-50 characters with uppercase, lowercase, number, and special character
"
sound: "ENTITY_ITEM_BREAK;1.0;1.0
"
timeout:
message: "&cPassword input session timed out!
"
sound: "ENTITY_ENDERMAN_TELEPORT;1.0;0.5
"
command: "
none
"
# Example: Towny town creation
towny_create:
timeout: 60
validation:
type: STRING
rules:
- "length
: 3;20
"
- "contains
: /^
[a-zA-Z0-9_
]+$/
"
actions:
- "send_message
:
&6&lTown Creation
"
- "send_title
:
&aCreate Your Town;&7Enter your town name;10;100;20
"
- "send_actionbar
:
&eTown name must be 3-20 characters, letters, numbers, and underscores only;200
"
success:
message: "&aTown '
{input
}' created successfully!
"
sound: "ENTITY_PLAYER_LEVELUP;1.0;1.0
"
command: "towny new
{input
}
"
fail:
message: "&cInvalid town name! Must be 3-20 characters, letters, numbers, and underscores only.
"
sound: "ENTITY_VILLAGER_NO;1.0;0.8
"
command: "
none
"
timeout:
message: "&cTown creation timed out!
"
sound: "ENTITY_ENDERMAN_TELEPORT;1.0;0.5
"
command: "
none
"