Negative Games Wiki
Discord
  • 👋Landing
  • 🎬Projects
    • 👮Punishments
      • 🖋️Commands
      • 📜Configuration
        • main.yml
        • messages.yml
        • Menus
          • history-main.yml
          • history.yml
          • note-delete-confirmation.yml
          • note-editor.yml
          • notes.yml
          • punish-confirm.yml
          • punish.yml
          • records-main.yml
          • records.yml
          • records-single.yml
          • staff-history-main.yml
          • staff-history.yml
          • staff-leaderboard.yml
    • 📑alumina
      • ItemBuilder
      • PotionBuilder
      • InputListener
      • Commands
      • DependencyLoader
      • Events Subscriber
      • Static Logger
Powered by GitBook
On this page

Was this helpful?

  1. Projects
  2. alumina

InputListener

This utility is a great way to capture a player's next chat message and execute logic based on it. This type of feature is typically used for "confirmation" messages where the user will have to say a certain word or message to confirm or cancel a certain action.

Example
UUID uuid = UUID.randomUUID(); // should be a player's uuid!
InputListener.listen(uuid, event -> {
    if (!(event.originalMessage() instanceof TextComponent text)) return;

    String message = text.content();

    Player player = event.getPlayer();
            
    if (message.equalsIgnoreCase("hi")) {
        player.sendMessage(Component.text("Hello!"));
    }
});
PreviousPotionBuilderNextCommands

Last updated 1 year ago

Was this helpful?

🎬
📑