Skip to content

Sign Input Menu

virtualWinter edited this page Aug 30, 2025 · 2 revisions

Sign Input Menu

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.

Basic Usage

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);

Key Methods

  • SignInputMenu.create(Player player, String[] lines, Consumer<List<String>> inputHandler): Creates a simple sign input menu with only an input handler. The lines array 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.

Example

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);
    }
}

Clone this wiki locally