Participant

Describes one participant of the current session:
  1. Username
  2. User-ID (corresponding to array-index of Flock.getAllParticipants()
  3. Requested Attributes
  4. If alive or has already quit


Summary

Method Summary
 long getAttributeNumber(java.lang.String key, long defaultValue)
          Get numeric attribute of this participant.
 java.lang.String getAttributeString(java.lang.String key, java.lang.String defaultValue)
          Get string attribute of this participant..
 int getUserId()
          Get unique ID [0..n] of this participant in this session.
 java.lang.String getUsername()
          Get the username of this participant
 boolean isActive()
          Check if participant is active or has quit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Details

Method Detail

getUsername

public java.lang.String getUsername()
Get the username of this participant

Returns:
username

getUserId

public int getUserId()
Get unique ID [0..n] of this participant in this session.

ID is a counter of the participants from [0..n], which corresponds to the Array indexes of getAllParticipants

Returns:
0..n if set
See Also:
FlockEngine.getAllParticipants()

isActive

public boolean isActive()
Check if participant is active or has quit

Returns:
true if active, false if participant quit the session

getAttributeString

public java.lang.String getAttributeString(java.lang.String key,
                                           java.lang.String defaultValue)

Get string attribute of this participant..

Attributes are retrieved from the database and cached at gamestart.

Parameters:
key - key to look for
defaultValue - default value to return if not found
Returns:
String with value if found, with defaultValue if not found
See Also:
FlockEngine.requestUserAttributeString(String key, String defValue)

getAttributeNumber

public long getAttributeNumber(java.lang.String key,
                               long defaultValue)

Get numeric attribute of this participant. (eg. level, points, etc.).

Attributes are retrieved from the database and cached at gamestart.

Parameters:
key - key to look for
defaultValue - default value to return if not found
Returns:
long with value if found, with defaultValue if not found
See Also:
FlockEngine.requestUserAttributeNumber(String key, long defValue)