|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.electrotank.electroserver5.client.events.Event<EsMessageType>
com.electrotank.electroserver5.client.api.helper.EsMessage
com.electrotank.electroserver5.client.api.helper.EsRequest
com.electrotank.electroserver5.client.api.EsCreateRoomRequest
public class EsCreateRoomRequest
This class represents a highly flexible server request. With it you can create a room, join that room if it already exists, set properties on that room (if it is being created), and set your own subscription properties for that room/zone.
Things to know about creating and joining rooms:
package {
import com.electrotank.electroserver5.api.CreateRoomRequest;
import com.electrotank.electroserver5.api.JoinRoomEvent;
import com.electrotank.electroserver5.api.MessageType;
import com.electrotank.electroserver5.ElectroServer;
import com.electrotank.electroserver5.user.User;
import com.electrotank.electroserver5.zone.Room;
import flash.events.Event;
public class RoomJoiner {
private var _es:ElectroServer;
public function initialize():void {
//listen for the JoinRoomEvent so we know when it happens
_es.engine.addEventListener(MessageType.JoinRoomEvent.name, onJoinRoomEvent);
//create the request and populate it with the room details
var crr:CreateRoomRequest = new CreateRoomRequest();
crr.roomName = "MyRoom";
crr.zoneName = "MyZone";
//send it
_es.engine.send(crr);
}
private function onJoinRoomEvent(e:JoinRoomEvent):void {
trace("room joined!");
//get the room you're in
var room:Room = _es.managerHelper.zoneManager.zoneById(e.zoneId).roomById(e.roomId);
//print out the users in the room
for each (var user:User in room.users) {
trace(user.userName);
}
}
public function set es(value:ElectroServer):void {
_es = value;
}
}
}
Here is a thorough example that uses room variables, changes room proprties, applies join subscriptions, and uses plugins.
package {
import com.electrotank.electroserver5.api.CreateRoomRequest;
import com.electrotank.electroserver5.api.EsObject;
import com.electrotank.electroserver5.api.JoinRoomEvent;
import com.electrotank.electroserver5.api.MessageType;
import com.electrotank.electroserver5.api.PluginListEntry;
import com.electrotank.electroserver5.api.RoomVariable;
import com.electrotank.electroserver5.ElectroServer;
import com.electrotank.electroserver5.user.User;
import com.electrotank.electroserver5.zone.Room;
import flash.events.Event;
public class RoomJoiner {
private var _es:ElectroServer;
public function initialize():void {
//listen for the JoinRoomEvent so we know when it happens
_es.engine.addEventListener(MessageType.JoinRoomEvent.name, onJoinRoomEvent);
var crr:CreateRoomRequest = new CreateRoomRequest();
crr.roomName = "MyRoom";
crr.zoneName = "MyZone";
//Set a few properties
crr.capacity = 10;
crr.roomDescription = "This is my room";
crr.password = "open sesame";
//create two room variables
//room var 1
var ob1:EsObject = new EsObject();
ob1.setString("Test_String", "blah");
ob1.setInteger("Test_int", 3);
var rv1:RoomVariable = new RoomVariable();
rv1.name = "test1";
rv1.value = ob1;
rv1.locked = true;
rv1.persistent = false;
//room var 2
var ob2:EsObject = new EsObject();
ob1.setString("Test_String2", "blah2");
ob1.setInteger("Test_int2", 12);
var rv2:RoomVariable = new RoomVariable();
rv2.name = "test2";
rv2.value = ob2;
rv2.locked = false;
rv2.persistent = false;
//add the room variables to the request
crr.variables = [rv1, rv2];
//Create a new plugin for this room
var pl:PluginListEntry = new PluginListEntry();
pl.extensionName = "ExamplePluginExtension";
pl.pluginHandle = "ExamplePlugin";
pl.pluginName = "ExamplePlugin";
//add the plugin to the request
crr.plugins = [pl];
//Now configure some of the user's subscription properties
crr.receivingRoomAttributeUpdates = false;//Don't want to receive updates about other rooms
crr.receivingRoomListUpdates = false;//Don't want to receive updates about when other rooms are created or destroyed
crr.receivingUserListUpdates = true;//true is the default. When true you will receive user list updates for your room.
//send it
_es.engine.send(crr);
}
private function onJoinRoomEvent(e:JoinRoomEvent):void {
trace("room joined!");
//get the room you're in
var room:Room = _es.managerHelper.zoneManager.zoneById(e.zoneId).roomById(e.roomId);
//print out the users in the room
for each (var user:User in room.users) {
trace(user.userName);
}
}
public function set es(value:ElectroServer):void {
_es = value;
}
}
}
| Constructor Summary | |
|---|---|
EsCreateRoomRequest()
|
|
EsCreateRoomRequest(org.apache.thrift.TBase t)
|
|
| Method Summary | |
|---|---|
void |
fromThrift(org.apache.thrift.TBase t_)
|
int |
getCapacity()
A room can be given a maximum number of users allowed in it at once. |
int |
getFloodingFilterBanDuration()
This property is used if a custom flooding filter has been specified. |
int |
getFloodingFilterFailuresBeforeKick()
This property is used if a custom flooding filter has been specified. |
int |
getFloodingFilterKicksBeforeBan()
This property is used if a custom flooding filter has been specified. |
String |
getFloodingFilterName()
The name of the custom flooding filter to use. |
int |
getLanguageFilterBanDuration()
This is used with a custom language filter. |
int |
getLanguageFilterFailuresBeforeKick()
This is used only with a custom language filter. |
int |
getLanguageFilterKicksBeforeBan()
This is used with a custom language filter. |
String |
getLanguageFilterName()
Custom language filters can be defined and given a name through the web-based administrator. |
String |
getPassword()
This is optional. |
List<EsPluginListEntry> |
getPlugins()
A list of PluginListEntry objects that represent the plugins that need to be created with this room. |
String |
getRoomDescription()
This is an optional public room-level property. |
String |
getRoomName()
Sets the name of the new room. |
List<EsRoomVariable> |
getVariables()
A list of RoomVariables to be used in the new room that is being created. |
int |
getZoneId()
The id of the zone in which you want to create the room. |
String |
getZoneName()
The name of the zone in which to create the new room. |
boolean |
isCreateOrJoinRoom()
The default is true. |
boolean |
isFloodingFilterResetAfterKick()
If using a custom flooding filter then this property is used. |
boolean |
isFloodingFilterSpecified()
You must set to true if a custom flooding filter name has been specified. |
boolean |
isHidden()
The default is false. |
boolean |
isLanguageFilterDeliverMessageOnFailure()
This is used only if a custom language filter is being used. |
boolean |
isLanguageFilterResetAfterKick()
This is used if a custom language filter has been specified. |
boolean |
isLanguageFilterSpecified()
If a custom language filter was specified by name using languageFilterName, then this property must be manually flagged to true. |
boolean |
isNonOperatorUpdateAllowed()
|
boolean |
isNonOperatorVariableUpdateAllowed()
|
boolean |
isPersistent()
The default is false. |
boolean |
isReceivingRoomAttributeUpdates()
The default is true. |
boolean |
isReceivingRoomListUpdates()
The default is true. |
boolean |
isReceivingRoomVariableUpdates()
The default is true. |
boolean |
isReceivingUserListUpdates()
The default is true. |
boolean |
isReceivingUserVariableUpdates()
The default is true. |
boolean |
isReceivingVideoEvents()
Default is true. |
boolean |
isUsingFloodingFilter()
The default if false. |
boolean |
isUsingLanguageFilter()
The default is false. |
com.electrotank.electroserver5.thrift.ThriftCreateRoomRequest |
newThrift()
|
void |
setCapacity(int v)
A room can be given a maximum number of users allowed in it at once. |
void |
setCreateOrJoinRoom(boolean v)
The default is true. |
void |
setFloodingFilterBanDuration(int v)
This property is used if a custom flooding filter has been specified. |
void |
setFloodingFilterFailuresBeforeKick(int v)
This property is used if a custom flooding filter has been specified. |
void |
setFloodingFilterKicksBeforeBan(int v)
This property is used if a custom flooding filter has been specified. |
void |
setFloodingFilterName(String v)
The name of the custom flooding filter to use. |
void |
setFloodingFilterResetAfterKick(boolean v)
If using a custom flooding filter then this property is used. |
void |
setFloodingFilterSpecified(boolean v)
You must set to true if a custom flooding filter name has been specified. |
void |
setHidden(boolean v)
The default is false. |
void |
setLanguageFilterBanDuration(int v)
This is used with a custom language filter. |
void |
setLanguageFilterDeliverMessageOnFailure(boolean v)
This is used only if a custom language filter is being used. |
void |
setLanguageFilterFailuresBeforeKick(int v)
This is used only with a custom language filter. |
void |
setLanguageFilterKicksBeforeBan(int v)
This is used with a custom language filter. |
void |
setLanguageFilterName(String v)
Custom language filters can be defined and given a name through the web-based administrator. |
void |
setLanguageFilterResetAfterKick(boolean v)
This is used if a custom language filter has been specified. |
void |
setLanguageFilterSpecified(boolean v)
If a custom language filter was specified by name using languageFilterName, then this property must be manually flagged to true. |
void |
setNonOperatorUpdateAllowed(boolean v)
|
void |
setNonOperatorVariableUpdateAllowed(boolean v)
|
void |
setPassword(String v)
This is optional. |
void |
setPersistent(boolean v)
The default is false. |
void |
setPlugins(List<EsPluginListEntry> v)
A list of PluginListEntry objects that represent the plugins that need to be created with this room. |
void |
setReceivingRoomAttributeUpdates(boolean v)
The default is true. |
void |
setReceivingRoomListUpdates(boolean v)
The default is true. |
void |
setReceivingRoomVariableUpdates(boolean v)
The default is true. |
void |
setReceivingUserListUpdates(boolean v)
The default is true. |
void |
setReceivingUserVariableUpdates(boolean v)
The default is true. |
void |
setReceivingVideoEvents(boolean v)
Default is true. |
void |
setRoomDescription(String v)
This is an optional public room-level property. |
void |
setRoomName(String v)
Sets the name of the new room. |
void |
setUsingFloodingFilter(boolean v)
The default if false. |
void |
setUsingLanguageFilter(boolean v)
The default is false. |
void |
setVariables(List<EsRoomVariable> v)
A list of RoomVariables to be used in the new room that is being created. |
void |
setZoneId(int v)
The id of the zone in which you want to create the room. |
void |
setZoneName(String v)
The name of the zone in which to create the new room. |
com.electrotank.electroserver5.thrift.ThriftCreateRoomRequest |
toThrift()
|
| Methods inherited from class com.electrotank.electroserver5.client.api.helper.EsMessage |
|---|
getMessageNumber, getMessageType, getRequestId, getServerId, setMessageNumber, setMessageType, setRequestId, setServerId |
| Methods inherited from class com.electrotank.electroserver5.client.events.Event |
|---|
getType, setType |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EsCreateRoomRequest()
public EsCreateRoomRequest(org.apache.thrift.TBase t)
| Method Detail |
|---|
public com.electrotank.electroserver5.thrift.ThriftCreateRoomRequest toThrift()
public com.electrotank.electroserver5.thrift.ThriftCreateRoomRequest newThrift()
public void fromThrift(org.apache.thrift.TBase t_)
public String getZoneName()
public void setZoneName(String v)
public int getZoneId()
public void setZoneId(int v)
public String getRoomName()
public void setRoomName(String v)
public int getCapacity()
public void setCapacity(int v)
public String getPassword()
public void setPassword(String v)
public String getRoomDescription()
public void setRoomDescription(String v)
public boolean isPersistent()
public void setPersistent(boolean v)
public boolean isHidden()
public void setHidden(boolean v)
public boolean isReceivingRoomListUpdates()
public void setReceivingRoomListUpdates(boolean v)
public boolean isReceivingRoomAttributeUpdates()
public void setReceivingRoomAttributeUpdates(boolean v)
public boolean isReceivingUserListUpdates()
public void setReceivingUserListUpdates(boolean v)
public boolean isReceivingUserVariableUpdates()
public void setReceivingUserVariableUpdates(boolean v)
public boolean isReceivingRoomVariableUpdates()
public void setReceivingRoomVariableUpdates(boolean v)
public boolean isReceivingVideoEvents()
public void setReceivingVideoEvents(boolean v)
public boolean isNonOperatorUpdateAllowed()
public void setNonOperatorUpdateAllowed(boolean v)
public boolean isNonOperatorVariableUpdateAllowed()
public void setNonOperatorVariableUpdateAllowed(boolean v)
public boolean isCreateOrJoinRoom()
public void setCreateOrJoinRoom(boolean v)
public List<EsPluginListEntry> getPlugins()
public void setPlugins(List<EsPluginListEntry> v)
public List<EsRoomVariable> getVariables()
public void setVariables(List<EsRoomVariable> v)
public boolean isUsingLanguageFilter()
public void setUsingLanguageFilter(boolean v)
public boolean isLanguageFilterSpecified()
public void setLanguageFilterSpecified(boolean v)
public String getLanguageFilterName()
public void setLanguageFilterName(String v)
public boolean isLanguageFilterDeliverMessageOnFailure()
public void setLanguageFilterDeliverMessageOnFailure(boolean v)
public int getLanguageFilterFailuresBeforeKick()
public void setLanguageFilterFailuresBeforeKick(int v)
public int getLanguageFilterKicksBeforeBan()
public void setLanguageFilterKicksBeforeBan(int v)
public int getLanguageFilterBanDuration()
public void setLanguageFilterBanDuration(int v)
public boolean isLanguageFilterResetAfterKick()
public void setLanguageFilterResetAfterKick(boolean v)
public boolean isUsingFloodingFilter()
public void setUsingFloodingFilter(boolean v)
public boolean isFloodingFilterSpecified()
public void setFloodingFilterSpecified(boolean v)
public String getFloodingFilterName()
public void setFloodingFilterName(String v)
public int getFloodingFilterFailuresBeforeKick()
public void setFloodingFilterFailuresBeforeKick(int v)
public int getFloodingFilterKicksBeforeBan()
public void setFloodingFilterKicksBeforeBan(int v)
public int getFloodingFilterBanDuration()
public void setFloodingFilterBanDuration(int v)
public boolean isFloodingFilterResetAfterKick()
public void setFloodingFilterResetAfterKick(boolean v)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||