public class SFSBuddy extends java.lang.Object implements Buddy
Any user can decide if they want to be online/off-line as Buddy in the Buddy system. By default a User is online every time he joins the Zone, but the User can also turn off this flag at runtime and disappear from other User's buddy lists. The Online State is persistent and based on a reserved Buddy Variable.
BuddyListManager
,
ReservedBuddyVariables
,
BuddyStorage
,
SFSEvent
Constructor and Description |
---|
SFSBuddy(java.lang.String name) |
SFSBuddy(java.lang.String name,
boolean isTemp) |
Modifier and Type | Method and Description |
---|---|
ISFSArray |
getBuddyVariablesData() |
java.lang.String |
getName()
The Buddy name, which corresponds to the User name.
|
java.lang.String |
getNickName()
Get the nickname of the Buddy.
|
BuddyList |
getParentBuddyList()
Return the parent BuddyList containing this Buddy
|
java.lang.String |
getState()
Returns the current Buddy State
|
BuddyVariable |
getVariable(java.lang.String varName)
Get a Buddy Variable from its name
|
java.util.List<BuddyVariable> |
getVariables()
Get all BuddyVariables
|
boolean |
hasVariables()
Checks if the Buddy has at least one variable set
|
boolean |
isBlocked()
When a Buddy is blocked he won't be able to see the User status and send him messages
|
boolean |
isOnline()
Checks if the Buddy is active in the system
|
boolean |
isTemp()
A temporary Buddy will only exist at runtime but will be lost as soon as he goes away
or the user is disconnected.
|
void |
setBlocked(boolean value)
Block the Buddy
|
void |
setIsTemp(boolean value) |
void |
setParentBuddyList(BuddyList parentList)
Set the parent BuddyList
|
void |
setVariable(BuddyVariable buddyVariable)
Set / modify a BuddyVariable.
|
void |
setVariables(java.util.List<BuddyVariable> buddyVariables)
Sets a number of variables at once.
|
ISFSArray |
toSFSArray() |
java.lang.String |
toString() |
public SFSBuddy(java.lang.String name)
public SFSBuddy(java.lang.String name, boolean isTemp)
public java.lang.String getName()
Buddy
public BuddyList getParentBuddyList()
Buddy
getParentBuddyList
in interface Buddy
public void setParentBuddyList(BuddyList parentList)
Buddy
setParentBuddyList
in interface Buddy
parentList
- the BuddyListpublic java.lang.String getState()
Buddy
public java.lang.String getNickName()
Buddy
getNickName
in interface Buddy
public boolean hasVariables()
Buddy
hasVariables
in interface Buddy
public BuddyVariable getVariable(java.lang.String varName)
Buddy
getVariable
in interface Buddy
varName
- the variable namepublic java.util.List<BuddyVariable> getVariables()
Buddy
getVariables
in interface Buddy
public boolean isBlocked()
Buddy
public boolean isOnline()
Buddy
public boolean isTemp()
Buddy
public void setBlocked(boolean value)
Buddy
setBlocked
in interface Buddy
value
- true to block the buddy, false to unblock himpublic void setVariable(BuddyVariable buddyVariable)
Buddy
setVariable
in interface Buddy
buddyVariable
- the Buddy Variablepublic void setVariables(java.util.List<BuddyVariable> buddyVariables)
Buddy
setVariables
in interface Buddy
buddyVariables
- a list of variablespublic ISFSArray toSFSArray()
toSFSArray
in interface Buddy
public ISFSArray getBuddyVariablesData()
getBuddyVariablesData
in interface Buddy
public java.lang.String toString()
toString
in class java.lang.Object