public void handle(Session client, MessageEvent msg) {
    String username = msg.readString();

    if (username.equals(client.getPlayer().getData().getUsername())) return;

    Session request = NetworkManager.getInstance().getSessions().getByPlayerUsername(username);

    if (request == null
        || request.getPlayer() == null
        || request.getPlayer().getMessenger() == null) return;

    if (!request.getPlayer().getSettings().getAllowFriendRequests()) {
      client.send(
          new AdvancedAlertMessageComposer(Locale.get("game.messenger.friendrequests.disabled")));
      return;
    }

    if (request.getPlayer().getMessenger().hasRequestFrom(client.getPlayer().getId())) return;

    request.getPlayer().getMessenger().addRequest(client.getPlayer().getId());
    request.send(new FriendRequestMessageComposer(client.getPlayer().getData()));

    int userId = PlayerDao.getIdByUsername(username);

    if (userId == 0) return;

    client.getPlayer().getQuests().progressQuest(QuestType.SOCIAL_FRIEND);
    MessengerDao.createRequest(client.getPlayer().getId(), userId);
  }
  @Override
  public void compose(IComposer msg) {
    msg.writeInt(roomId);
    msg.writeInt(playersWithRights.size());

    for (Integer id : playersWithRights) {
      msg.writeInt(id);

      String username = PlayerDao.getUsernameByPlayerId(id);
      msg.writeString(username != null ? username : "******");
    }
  }
  @Override
  public void run() {
    if (playerData.size() == 0) {
      // No data to be saved!
      return;
    }

    log.debug("Saving " + this.playerData.size() + " player data instances");

    PlayerDao.saveBatch(this.playerData);

    this.playerData.clear();
  }