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
Example of simulating live chat!
Integration
Sample Code
Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
Displaying a Live Chat Message
public void displayLiveChatMessageExample() {
BukkitRunnable runnable = new BukkitRunnable() {
private int countdown = 5;
@Override
public void run() {
ChatApiExample.this.chatModule.displayLiveChatMessage(Recipients.ofEveryone(),
Component.text("Game starting in ", NamedTextColor.GREEN)
.append(Component.text(this.countdown, NamedTextColor.BLUE)),
13
);
if (--this.countdown == 0) {
ChatApiExample.this.chatModule.displayLiveChatMessage(Recipients.ofEveryone(),
Component.text("Game started! ", NamedTextColor.GREEN),
13
);
this.cancel();
}
}
};
runnable.runTaskTimer(ApolloExamplePlugin.getPlugin(), 0L, 20L);
}
Removing a Live Chat Message
public void removeLiveChatMessageExample() {
this.chatModule.removeLiveChatMessage(Recipients.ofEveryone(), 13);
}