-
Notifications
You must be signed in to change notification settings - Fork 0
Sign Input Menu
virtualWinter edited this page Aug 30, 2025
·
2 revisions
The SignInputMenu is another way to get text input from a player, this time by using a sign interface. The player is prompted to enter text on a sign, and the lines of text are captured when they close the sign editor.
To get text input from a player, you can create a SignInputMenu and provide a callback to handle the submitted lines of text.
SignInputMenu.create(
player,
new String[]{"", "^^^^^^^^^^^^^^^", "Enter your", "text here"},
lines -> {
String combined = String.join(" ", lines);
player.sendMessage("You entered: " + combined);
}
).open(player);-
SignInputMenu.create(Player player, String[] lines, Consumer<List<String>> inputHandler): Creates a simple sign input menu with only an input handler. Thelinesarray provides the initial text on the sign. -
SignInputMenu.create(Player player, String[] lines, Consumer<List<String>> inputHandler, Consumer<Player> cancelHandler): Creates a sign input menu with both input and cancel handlers.
import club.catmc.utils.menu.SignInputMenu;
import org.bukkit.entity.Player;
public class MenuExamples {
public void openSignInputMenu(Player player) {
SignInputMenu.create(
player,
new String[]{"", "^^^^^^^^^^^^^^^", "Enter your", "text here"},
lines -> {
String combined = String.join(" ", lines);
player.sendMessage("You entered: " + combined);
}
).open(player);
}
}© 2025 CatMC Network. This project is licensed under the ISC License.