Package com.smartfoxserver.api
Class SFSMMOApi
java.lang.Object
com.smartfoxserver.api.SFSMMOApi
- All Implemented Interfaces:
ISFSMMOApi
Provides access to the API for managing MMORooms.
Tutorial
To learn more see this introductory tutorial.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.slf4j.Loggerprotected final com.smartfoxserver.api.response.ISFSMMOResponseApiprotected final SmartFoxServerprotected final SFSApi -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.smartfoxserver.api.response.ISFSMMOResponseApivoidremoveMMOItem(BaseMMOItem item) Remove an MMOItem from an MMORoom.voidsendObjectMessage(Room targetRoom, User sender, ISFSObject message, Vec3D aoi) Send an Object message based on a custom SFSObject that can contain any data.voidsendPublicMessage(Room targetRoom, User sender, String message, ISFSObject params, Vec3D aoi) Sends a public chat message.voidsetMMOItemPosition(BaseMMOItem item, Vec3D pos, Room targetRoom) Set or update an MMOItem inside an MMORoomvoidsetMMOItemVariables(BaseMMOItem item, List<IMMOItemVariable> variables) Set MMOItemVariables.voidsetMMOItemVariables(BaseMMOItem item, List<IMMOItemVariable> variables, boolean fireClientEvent) Set MMOItemVariables.voidsetUserPosition(User user, Vec3D pos, Room targetRoom) Set the new User position inside an MMORoom
-
Field Details
-
sfs
-
log
protected final org.slf4j.Logger log -
sfsAPI
-
mmoResponseApi
protected final com.smartfoxserver.api.response.ISFSMMOResponseApi mmoResponseApi
-
-
Constructor Details
-
SFSMMOApi
-
-
Method Details
-
getResponseAPI
public com.smartfoxserver.api.response.ISFSMMOResponseApi getResponseAPI()- Specified by:
getResponseAPIin interfaceISFSMMOApi
-
sendObjectMessage
Send an Object message based on a custom SFSObject that can contain any data. Typically this is used for sending game moves to players or other game related updates.
The difference with the regular version of this Request is that it works with a custom Area Of Interest (AOI) inside an MMORoom. Instead of using the default Room AOI here we can specify a custom AOI which should be smaller that the default one.
NOTE: The sender must be joined in the target MMORoom.
- Specified by:
sendObjectMessagein interfaceISFSMMOApi- Parameters:
targetRoom- the MMORoomsender- the sender of the Objectmessage- the dataaoi- the custom Area Of Interest (AOI)
-
sendPublicMessage
public void sendPublicMessage(Room targetRoom, User sender, String message, ISFSObject params, Vec3D aoi) Sends a public chat message.The difference with the regular version of this Request is that it works with a custom Area Of Interest (AOI) inside an MMORoom. Instead of using the default Room AOI here we can specify a custom AOI which should be smaller that the default one.
- Specified by:
sendPublicMessagein interfaceISFSMMOApi- Parameters:
targetRoom- the MMORoomsender- the sender of the Messagemessage- the chat messageparams- an optional data object (e.g. to define font and color of the message)aoi- the custom Area Of Interest (AOI)
-
setUserPosition
Set the new User position inside an MMORoom- Specified by:
setUserPositionin interfaceISFSMMOApi- Parameters:
user- The Userpos- The new positiontargetRoom- The target MMORoom- See Also:
-
setMMOItemPosition
Set or update an MMOItem inside an MMORoom- Specified by:
setMMOItemPositionin interfaceISFSMMOApi- Parameters:
item- the MMOItempos- the position in 2D/3D spacetargetRoom- the target MMORoom- See Also:
-
removeMMOItem
Remove an MMOItem from an MMORoom. (A Room is not required here as the system already keeps track of which MMOItem belongs to which MMORoom) This in turn will affect all Users who had this MMOItem in their AOI via a client side PROXIMITY_LIST_UPDATE- Specified by:
removeMMOItemin interfaceISFSMMOApi- Parameters:
item- the MMOItem to remove- See Also:
-
setMMOItemVariables
Set MMOItemVariables. Only the changed variables are broadcast to Users that can "see" the MMOItem in the MMORoom. In order to delete a variable set it to null.- Specified by:
setMMOItemVariablesin interfaceISFSMMOApi- Parameters:
item- the MMOItem, owner of the variablesvariables- the variables- See Also:
-
setMMOItemVariables
public void setMMOItemVariables(BaseMMOItem item, List<IMMOItemVariable> variables, boolean fireClientEvent) Set MMOItemVariables. Only the changed variables are broadcast to the Users that can "see" the MMOItem in the MMORoom. In order to delete a variable set it to null.- Specified by:
setMMOItemVariablesin interfaceISFSMMOApi- Parameters:
item- the MMOItem, owner of the variablesvariables- the variablesfireClientEvent- set to true to send an update to clients- See Also:
-