Search in sources :

Example 6 with ChatMessageEvent

use of com.faforever.client.chat.event.ChatMessageEvent in project downlords-faf-client by FAForever.

the class PircBotXChatService method onAction.

private void onAction(ActionEvent event) {
    User user = event.getUser();
    if (user == null) {
        logger.warn("Action event without user: {}", event);
        return;
    }
    String source;
    org.pircbotx.Channel channel = event.getChannel();
    if (channel == null) {
        source = user.getNick();
    } else {
        source = channel.getName();
    }
    eventBus.post(new ChatMessageEvent(new ChatMessage(source, Instant.ofEpochMilli(event.getTimestamp()), user.getNick(), event.getMessage(), true)));
}
Also used : User(org.pircbotx.User) ChatMessageEvent(com.faforever.client.chat.event.ChatMessageEvent)

Example 7 with ChatMessageEvent

use of com.faforever.client.chat.event.ChatMessageEvent in project downlords-faf-client by FAForever.

the class PircBotXChatService method onMessage.

private void onMessage(MessageEvent event) {
    User user = event.getUser();
    if (user == null) {
        logger.warn("Action event without user: {}", event);
        return;
    }
    String source;
    org.pircbotx.Channel channel = event.getChannel();
    source = channel.getName();
    eventBus.post(new ChatMessageEvent(new ChatMessage(source, Instant.ofEpochMilli(event.getTimestamp()), user.getNick(), event.getMessage(), false)));
}
Also used : User(org.pircbotx.User) ChatMessageEvent(com.faforever.client.chat.event.ChatMessageEvent)

Aggregations

ChatMessageEvent (com.faforever.client.chat.event.ChatMessageEvent)7 User (org.pircbotx.User)4 AbstractPlainJavaFxTest (com.faforever.client.test.AbstractPlainJavaFxTest)3 Test (org.junit.Test)3 Tab (javafx.scene.control.Tab)2 Player (com.faforever.client.player.Player)1 CompletableTask (com.faforever.client.task.CompletableTask)1 CompletableFuture (java.util.concurrent.CompletableFuture)1