public class SFSMMOApi extends java.lang.Object implements ISFSMMOApi
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log |
protected com.smartfoxserver.v2.api.response.ISFSMMOResponseApi |
mmoResponseApi |
protected SmartFoxServer |
sfs |
protected SFSApi |
sfsAPI |
Constructor and Description |
---|
SFSMMOApi(SmartFoxServer sfs) |
Modifier and Type | Method and Description |
---|---|
com.smartfoxserver.v2.api.response.ISFSMMOResponseApi |
getResponseAPI() |
void |
removeMMOItem(BaseMMOItem item)
Remove an MMOItem from an MMORoom.
|
void |
sendObjectMessage(Room targetRoom,
User sender,
ISFSObject message,
Vec3D aoi)
Send an Object message based on a custom SFSObject that can contain any data.
|
void |
sendPublicMessage(Room targetRoom,
User sender,
java.lang.String message,
ISFSObject params,
Vec3D aoi)
Sends a public chat message.
|
void |
setMMOItemPosition(BaseMMOItem item,
Vec3D pos,
Room targetRoom)
Set or update an MMOItem inside an MMORoom
|
void |
setMMOItemVariables(BaseMMOItem item,
java.util.List<IMMOItemVariable> variables)
Set MMOItemVariables.
|
void |
setMMOItemVariables(BaseMMOItem item,
java.util.List<IMMOItemVariable> variables,
boolean fireClientEvent)
Set MMOItemVariables.
|
void |
setUserPosition(User user,
Vec3D pos,
Room targetRoom)
Set the new User position inside an MMORoom
|
protected final SmartFoxServer sfs
protected final org.slf4j.Logger log
protected final SFSApi sfsAPI
protected final com.smartfoxserver.v2.api.response.ISFSMMOResponseApi mmoResponseApi
public SFSMMOApi(SmartFoxServer sfs)
public com.smartfoxserver.v2.api.response.ISFSMMOResponseApi getResponseAPI()
getResponseAPI
in interface ISFSMMOApi
public void sendObjectMessage(Room targetRoom, User sender, ISFSObject message, Vec3D aoi)
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. Attempting to use a larger AOI is not possible.
NOTE: The sender must be joined in the target MMORoom.
sendObjectMessage
in interface ISFSMMOApi
targetRoom
- the MMORoomsender
- the sender of the Objectmessage
- the dataaoi
- the custom Area Of Interest (AOI)public void sendPublicMessage(Room targetRoom, User sender, java.lang.String message, ISFSObject params, Vec3D aoi)
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. Attempting to use a larger AOI is not possible.
sendPublicMessage
in interface ISFSMMOApi
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)public void setUserPosition(User user, Vec3D pos, Room targetRoom)
setUserPosition
in interface ISFSMMOApi
user
- The Userpos
- The new positiontargetRoom
- The target MMORoomMMORoom
public void setMMOItemPosition(BaseMMOItem item, Vec3D pos, Room targetRoom)
setMMOItemPosition
in interface ISFSMMOApi
item
- the MMOItempos
- the position in 2D/3D spacetargetRoom
- the target MMORoomMMORoom
,
MMOItem
public void removeMMOItem(BaseMMOItem item)
removeMMOItem
in interface ISFSMMOApi
item
- the MMOItem to removeMMORoom
,
MMOItem
public void setMMOItemVariables(BaseMMOItem item, java.util.List<IMMOItemVariable> variables)
setMMOItemVariables
in interface ISFSMMOApi
item
- the MMOItem, owner of the variablesvariables
- the variablesMMOItemVariable
,
MMOItem
,
MMORoom
public void setMMOItemVariables(BaseMMOItem item, java.util.List<IMMOItemVariable> variables, boolean fireClientEvent)
setMMOItemVariables
in interface ISFSMMOApi
item
- the MMOItem, owner of the variablesvariables
- the variablesfireClientEvent
- set to true to send an update to clientsMMOItemVariable
,
MMOItem
,
MMORoom