Apollo
Developers
Modules
Chat

Chat Module

Overview

The chat module allows you to interact with and modify users chat feeds.

  • Adds the ability to simulate live updating messages
    • Grants the ability to remove specific messages for a player

Chat Module Example

Example of simulating live chat!

Integration

private final int messageId = ThreadLocalRandom.current().nextInt(100);
private int countdown = 5;
 
public void displayLiveMessageExample() {
    this.chatModule.displayLiveChatMessage(Recipients.ofEveryone(),
        Component.text("Game starting in ", NamedTextColor.GREEN)
            .append(Component.text(this.countdown, NamedTextColor.BLUE)),
        this.messageId
    );
 
    if (--this.countdown == 0) {
        this.countdown = 5;
    }
}

Removing a specific live message for a player

public void removeLiveMessageExample() {
    this.chatModule.removeLiveChatMessage(Recipients.ofEveryone(), this.messageId);
}