ChatSetup - Revolutionary Chat Input for Spigot plugins!
Say goodbye to complex chat listeners – Collect player input like a human!
What is McChatSetup?
McChatSetup is a
lightweight,
feature-rich Java library that lets you
create seamless chat-based input systems using fluent builder pattern - perfect for Spigot plugin developers who want
elegant,
readable, and
powerful player input collection.
Forget complex event handling. Use expressions like:
Code (Java):
McChatSetup.
empty
(plugin
)
.
addPlayer
(player
)
.
append
(
"&aEnter your message within <time> seconds!"
)
.
setTime
(
30
)
.
onInput
(input
-> player.
sendMessage
(
"You said: "
+ input
)
)
.
build
(
)
;
Why McChatSetup over Manual Chat Listeners?
Traditional Bukkit:
Code (Java):
// Messy, error-prone, memory leaks everywhere!
Map
<UUID, Long
> waitingPlayers
=
new HashMap
<>
(
)
;
@EventHandler
public
void onPlayerChat
(AsyncPlayerChatEvent event
)
{
UUID uuid
= event.
getPlayer
(
).
getUniqueId
(
)
;
if
(waitingPlayers.
containsKey
(uuid
)
)
{
// Handle timeout manually
// Clean up manually
// Validate manually
// What a mess!
}
}
With McChatSetup:
Code (Java):
McChatSetup.
empty
(plugin
)
.
addPlayer
(player
)
.
append
(
"&eWhat's your favorite color?"
)
.
setTime
(
20
)
.
withValidator
(input
-> input.
length
(
)
>
2
)
.
onInput
(color
-> player.
sendMessage
(
"&aYour favorite: "
+ color
)
)
.
onFail
(
(
)
-> player.
sendMessage
(
"&cTime's up!"
)
)
.
build
(
)
;
// Automatic cleanup, validation, timeout handling!
Advanced Features for Developers
✔️ Multi-Setup Input Chains
Code (Java):
public
void startPlayerRegistration
(Player player
)
{
McChatSetup.
empty
(plugin
)
.
addPlayer
(player
)
.
append
(
"&a&lStep 1/3: &eEnter your username:"
)
.
setTime
(
30
)
.
withValidator
(input
-> input.
length
(
)
>=
3
)
.
onInput
(username
->
{
// Chain to next step
McChatSetup.
empty
(plugin
)
.
addPlayer
(player
)
.
append
(
"&a&lStep 2/3: &eEnter your email:"
)
.
withValidator
(
this
::isValidEmail
)
.
onInput
(email
-> askForAge
(player, username, email
)
)
.
build
(
)
;
}
)
.
build
(
)
;
}
✔️ Smart Validation System
Code (Java):
// Number input with validation
McChatSetup.
empty
(plugin
)
.
addPlayer
(player
)
.
append
(
"&aEnter a number between 1-100:"
)
.
withValidator
(input
->
{
try
{
int num
=
Integer.
parseInt
(input
)
;
if
(num
<
1
|| num
>
100
)
{
player.
sendMessage
(
"&cMust be between 1-100!"
)
;
return
false
;
}
return
true
;
}
catch
(
NumberFormatException e
)
{
player.
sendMessage
(
"&cPlease enter a valid number!"
)
;
return
false
;
}
}
)
.
onInput
(input
->
{
int number
=
Integer.
parseInt
(input
)
;
player.
sendMessage
(
"&aYou entered: "
+ number
)
;
}
)
.
build
(
)
;
✔️ Group Input Sessions
Code (Java):
// Collect votes from multiple players
Set
<Player
> guildMembers
= getGuildMembers
(guild
)
;
McChatSetup.
empty
(plugin
)
.
addPlayers
(guildMembers
)
.
append
(
"&6Guild Vote: &eGo to war? (yes/no)"
)
.
setTime
(
60
)
.
withValidator
(input
-> input.
matches
(
"(?i)(yes|no)"
)
)
.
onInput
(vote
-> recordVote
(player, vote
)
)
.
onSuccess
(
(
)
-> tallyVotes
(guild
)
)
.
build
(
)
;
Why choose McChatSetup?
- Fluent Builder Pattern - intuitive, readable code
- Smart Timeouts - automatic cleanup, no memory leaks
- Built-in Validation - real-time feedback to players
- Multiple Callbacks - handle start, input, success, failure
- Rich Formatting - MiniMessage support with placeholders
- Thread-Safe - perfect for concurrent plugin enviroments
- Zero configuration - works out of the box!
- Memory Safe - automatic resource management
- Sign, and Chat input also!