Skip to content

Fameless9/ChatResponseAPI

Repository files navigation

ChatResponseAPI

A simple and lightweight API to await player chat responses asynchronously in Spigot plugins.

JitPack


✨ Features

  • Await player chat input asynchronously
  • Works with timeouts
  • Perfect for menus, prompts, or simple chat-based forms

📦 Installation

Add JitPack to your repositories

build.gradle.kts (Kotlin DSL)
repositories {
    maven("https://jitpack.io")
}
build.gradle (Groovy DSL)
repositories {
    maven { url 'https://jitpack.io' }
}
pom.xml (Maven)
<repositories>
  <repository>
      <id>jitpack.io</id>
      <url>https://jitpack.io</url>
  </repository>
</repositories>

Add the dependency

build.gradle.kts
dependencies {
    compileOnly("com.github.Fameless9:ChatResponseAPI:1.0.0")
}
build.gradle
dependencies {
    compileOnly 'com.github.Fameless9:ChatResponseAPI:1.0.0'
}
pom.xml
<dependency>
  <groupId>com.github.Fameless9</groupId>
  <artifactId>ChatResponseAPI</artifactId>
  <version>1.0.0</version>
  <scope>provided</scope>
</dependency>

Register the API listener

Register the ChatResponseListener in your onEnable method:

getServer().getPluginManager().registerEvents(ChatResponseListener.INSTANCE, this);

🛠️ Usage Example

player.sendMessage("What does rule 4 say?");
ChatResponseAPI.awaitResponse(player, 10_000).thenAccept(response -> {
    player.sendMessage("You answered: " + response);
});

📄 License

This project is licensed under the MIT License – see LICENSE for details.

About

API to get chat responses from players easily and asynchronously

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages