Skip to content

ChatHandler

Denis Istratov edited this page Jul 28, 2023 · 1 revision

ChatHandler allows to run some action when the handled player writes something to the chat. The player's message will be canceled. After running the action, the player is no longer handled.

Steps to start using ChatHandler:

  1. Get an instance of the ChatHanlder class:
ChatHandler chatHandler = ChatHandler.getInstance();
  1. Bind it to your plugin
chatHandler.bind(plugin);
  1. Start the handle player:
ChatHandler.getInstance().handle(player, (player, message) -> {
    if(message.equals("yes")) player.sendMessage("ok");
});

Clone this wiki locally