Package sfs2x.client.entities
Class MMOItem
- java.lang.Object
-
- sfs2x.client.entities.MMOItem
-
- All Implemented Interfaces:
IMMOItem
public class MMOItem extends java.lang.Object implements IMMOItem
An MMOItem represents an active non-player entity inside an MMORoom.MMOItems can be used to represent bonuses, triggers, bullets, etc, or any other non-player entity that will be handled using the MMORoom's rules of visibility. This means that whenever one or more MMOItems fall within the Area of Interest of a user, their presence will be notified to that user by means of the SFSEvent.PROXIMITY_LIST_UPDATE event.
MMOItems are identified by a unique ID and can have one or more MMOItem Variables associated to store custom data.
NOTE: MMOItems can be created in a server side Extension only; client side creation is not allowed.
- See Also:
MMORoom
,MMOItemVariable
-
-
Constructor Summary
Constructors Constructor Description MMOItem(int id)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsVariable(java.lang.String name)
Indicates whether this MMOItem has the specified Item Variable set or not.static IMMOItem
fromSFSArray(com.smartfoxserver.v2.entities.data.ISFSArray encodedItem)
Vec3D
getAOIEntryPoint()
Returns the entry point within the User's AOI where this object "appeared" with the last PROXIMITY_LIST_UPDATE event.int
getId()
The unique ID of this itemIMMOItemVariable
getVariable(java.lang.String name)
Retrieves a User Variable from its name.java.util.List<IMMOItemVariable>
getVariables()
Retrieves all the Variables of this Itemvoid
setAOIEntryPoint(Vec3D aoiEntryPoint)
void
setVariable(IMMOItemVariable var)
privatevoid
setVariables(java.util.List<IMMOItemVariable> varList)
privatejava.lang.String
toString()
-
-
-
Method Detail
-
fromSFSArray
public static IMMOItem fromSFSArray(com.smartfoxserver.v2.entities.data.ISFSArray encodedItem)
-
containsVariable
public boolean containsVariable(java.lang.String name)
Indicates whether this MMOItem has the specified Item Variable set or not.- Specified by:
containsVariable
in interfaceIMMOItem
- Parameters:
name
- The name of the MMOItemVariable whose existence must be checked.- Returns:
- true if a MMOItemVariable with the passed name exists for this MMOItem.
-
getAOIEntryPoint
public Vec3D getAOIEntryPoint()
Returns the entry point within the User's AOI where this object "appeared" with the last PROXIMITY_LIST_UPDATE event. This field is populated only if the MMORoom is configured to receive this data.- Specified by:
getAOIEntryPoint
in interfaceIMMOItem
- See Also:
MMORoomSettings.setSendAOIEntryPoint(boolean)
,SFSEvent.PROXIMITY_LIST_UPDATE
-
setAOIEntryPoint
public void setAOIEntryPoint(Vec3D aoiEntryPoint)
-
getVariable
public IMMOItemVariable getVariable(java.lang.String name)
Retrieves a User Variable from its name.- Specified by:
getVariable
in interfaceIMMOItem
- Parameters:
name
- The name of the User Variable to be retrieved.- Returns:
- The MMOItemVariable, or null if no MMOItemVariable with the passed name is associated with this MMOItem.
- See Also:
IMMOItem.getVariables()
,MMOItemVariable
-
getVariables
public java.util.List<IMMOItemVariable> getVariables()
Retrieves all the Variables of this Item- Specified by:
getVariables
in interfaceIMMOItem
- Returns:
- The list of ItemVariable objects associated with the Item
- See Also:
MMOItemVariable
,IMMOItem.getVariable(String)
-
setVariable
public void setVariable(IMMOItemVariable var)
private- Specified by:
setVariable
in interfaceIMMOItem
-
setVariables
public void setVariables(java.util.List<IMMOItemVariable> varList)
private- Specified by:
setVariables
in interfaceIMMOItem
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-