use of com.faforever.client.chat.InitiatePrivateChatEvent in project downlords-faf-client by FAForever.
the class FriendOnlineNotifier method onUserOnline.
@Subscribe
public void onUserOnline(UserOnlineEvent event) {
String username = event.getUsername();
Player player = playerService.getPlayerForUsername(username);
if (player != null && player.getSocialStatus() == SocialStatus.FRIEND) {
audioService.playFriendOnlineSound();
notificationService.addNotification(new TransientNotification(i18n.get("friend.nowOnlineNotification.title", username), i18n.get("friend.nowOnlineNotification.action"), IdenticonUtil.createIdenticon(player.getId()), actionEvent -> {
eventBus.post(new NavigateEvent(NavigationItem.CHAT));
eventBus.post(new InitiatePrivateChatEvent(username));
}));
}
}
Aggregations