usernameAlias = username;
pm = PresenceManagerFactory.getPresenceManager(session);
PresenceInfo pi = pm.getUserPresenceInfo(orbCell.getUsername());
if (pi != null) {
usernameAlias = pi.getUsernameAlias();
}
WonderlandIdentity userID = new WonderlandIdentity(username, usernameAlias, null);
presenceInfo = new PresenceInfo(orbCell.getCellID(), null, userID, orbCell.getCallID());
presenceInfo.setUsernameAlias(usernameAlias);
pm.addPresenceManagerListener(this);
if (playerWithVpCallID == null || playerWithVpCallID.equals(orbCell.getCallID())) {
/*
* It's a real call. Use the actual callID and userID.
*/
pm.addLocalPresenceInfo(presenceInfo);
presenceInfoAdded = true;
}
nameTagComp = new NameTagComponent(orbCell, 0.15f);
// SIZE should be 0.17
orbCell.addComponent(nameTagComp);
nameTag = nameTagComp.getRenderer(Cell.RendererType.RENDERER_JME);
nameTagComp.setNameTag(EventType.CHANGE_NAME, username, usernameAlias);
setBystanders(bystanders);
if (orbCell.getPlayerWithVpCallID() != null) {
PresenceInfo info = pm.getPresenceInfo(playerWithVpCallID);
if (info == null) {
logger.warning("Can't find presence info for CallID "
+ playerWithVpCallID);
return;
}
logger.info("Attach orb " + orbCell.getCellID()
+ " player with " + playerWithVpCallID + " to " + info);
channelComp.send(new OrbAttachMessage(orbCell.getCellID(), info.getCellID(), true));
} else {
/*
* Ask the server to tell us if the orb is attached.
*/
logger.fine("Asking server if orb is attached " + orbCell.getCellID());