예제 #1
0
  /**
   * Sets the current <code>UserID</code> for this <code>Player</code>, which changes from session
   * to session. Typically this is called when the player first logs again, and not again until the
   * player logs out and logs back in.
   *
   * @param uid the player's user identifier
   */
  public void setCurrentSession(ClientSession session) {
    DataManager dataMgr = AppContext.getDataManager();
    dataMgr.markForUpdate(this);
    currentSessionRef = dataMgr.createReference(session);

    // Also inform the client of the session ID
    // FIXME, this is hacked in as the only non-channel message
    // for ease of porting -JM
    BigInteger sid = currentSessionRef.getId();
    byte[] bytes = sid.toByteArray();
    session.send(ByteBuffer.wrap(bytes));
  }