|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.electrotank.electroserver5.extensions.api.ElectroServerApiImpl
public abstract class ElectroServerApiImpl
The ElectroServerApiImpl provides functionality to all custom code and allows the various extensions to interact with the server directly. This API is extended by "function" specific APIs that are used to provide functionality for given components, ie. events, plugins, managed objects, etc. This class and its children classes are provided to extensions automatically and before the first call is made.
| Field Summary | |
|---|---|
protected com.electrotank.electroserver5.entities.managers.ExtensionManager |
extensionManager
|
| Constructor Summary | |
|---|---|
ElectroServerApiImpl(com.electrotank.electroserver5.entities.BaseBridge bridge,
com.electrotank.electroserver5.servers.registry.GatewaySender gateways,
com.electrotank.electroserver5.entities.managers.RoomManager roomManager,
com.electrotank.electroserver5.entities.People people,
ScheduledExecutorService scheduledExecutorService,
com.electrotank.electroserver5.entities.managers.LanguageFilterManager languageFilterManager,
EsFileSystemApi fileSystem,
com.electrotank.electroserver5.entities.managers.GameManager gameManager,
com.electrotank.electroserver5.entities.managers.BuddyListManager buddyListManager,
com.electrotank.electroserver5.entities.managers.UserEventManager eventManager,
com.electrotank.electroserver5.entities.managers.ExtensionManager extensionManager)
|
|
| Method Summary | |
|---|---|
Object |
acquireManagedObject(String factoryName,
EsObjectRO parameters)
Acquires a managed object from the specified managed object factory. |
boolean |
addBuddy(String userName,
String buddyName,
EsObjectRO esObject)
Adds a buddy to the specified user's buddy list. |
RoomResponse |
addUsersToRoom(int zoneId,
int roomId,
String password,
Collection<UserConfig> userConfigs)
Adds the users defined in the UserConfig collection to the specified room. |
RoomResponse |
addUsersToRoom(int zoneId,
int roomId,
String password,
UserConfig[] userConfigs)
Adds the users defined in the UserConfig array to the specified room. |
LanguageFilterResponse |
applyLanguageFilterToString(String languageFilterName,
String stringToTest)
Used to call one of the configured language filters to determine if a given string is valid or not. |
boolean |
areLoginsEnabled()
Returns true if users are currently allowed to log in. |
void |
banUserFromRoom(String userName,
int zoneId,
int roomId,
int duration,
String reason)
Used to kick and ban a user from a room with a specified message. |
HttpResults |
blockAndCallUrl(String url,
boolean isPOST,
Map<String,String> parameters)
Calls a URL and blocks the current thread of execution until a response is recieved or a global timeout is reached. |
EsObject |
callRoomPlugin(int zoneId,
int roomId,
String pluginName,
EsObjectRO parameters)
Used to invoke the interop
method on the designated server-level plugin. |
EsObject |
callServerPlugin(String pluginName,
EsObjectRO parameters)
Used to invoke the interop
method on the designated server-level plugin. |
void |
callUrl(String url,
boolean isPOST,
Map<String,String> parameters,
HttpCallback callback)
Calls a URL asynchronously and invokes the callback once the call completes. |
void |
callUrlFromScript(String url,
boolean isPOST,
Map<String,String> parameters,
String callbackName)
Calls a URL asynchronously and invokes the method defined by the callback name once the call completes. |
void |
cancelScheduledExecution(int id)
Cancels the scheduled execution identified by the ID. |
GameManagerResponse |
carefullyCreateGameForUsers(String gameType,
Collection<String> users,
String zoneName,
String password,
boolean locked,
boolean hidden,
EsObject gameDetails)
Used to directly create a game for the identified users via the GameManager. |
GameManagerResponse |
createGameForUsers(String gameType,
Collection<String> users,
String zoneName,
String password,
boolean locked,
boolean hidden,
EsObject gameDetails)
Used to directly create a game for the identified users via the GameManager. |
GameManagerResponse |
createGameForUsers(String gameType,
String[] users,
String zoneName,
String password,
boolean locked,
boolean hidden,
EsObject gameDetails)
Used to directly create a game for the identified users via the GameManager. |
UserVariableResponse |
createOrUpdateUserVariable(String userName,
String name,
EsObject value)
Creates or updates a user variable as needed. |
RoomResponse |
createRoom(int zoneId,
RoomConfiguration roomConfig,
Collection<UserConfig> userConfigs)
Creates a room in the specified zone using the supplied room configuration. |
RoomResponse |
createRoom(int zoneId,
RoomConfiguration roomConfig,
UserConfig[] userConfigs)
Creates a room in the specified zone using the supplied room configuration. |
RoomResponse |
createRoomInNamedZone(String zoneName,
boolean joinExistingZone,
RoomConfiguration roomConfig,
Collection<UserConfig> userConfigs)
Creates a room in the specified zone using the supplied room configuration. |
RoomResponse |
createRoomInNamedZone(String zoneName,
boolean joinExistingZone,
RoomConfiguration roomConfig,
UserConfig[] userConfigs)
Creates a room in the specified zone using the supplied room configuration. |
RoomVariableResponse |
createRoomVariable(int zoneId,
int roomId,
String name,
EsObject value,
boolean locked)
Creates a room variable in the specified room. |
RoomVariableResponse |
createRoomVariableForUser(int zoneId,
int roomId,
String name,
EsObject value,
boolean locked,
String username,
boolean persistent)
Creates a room variable in the specified room, tied to a given user. |
ExtensionBoundUserServerVariableResponse |
deleteExtensionBoundUserServerVariable(String userName,
String variableName)
Deletes an extension-bound user server variable. |
RoomVariableResponse |
deleteRoomVariable(int zoneId,
int roomId,
String name)
Deletes the specified room variable. |
UserServerVariableResponse |
deleteUserServerVariable(String userName,
String variableName)
Deletes a given user server variable from the specified user. |
UserVariableResponse |
deleteUserVariable(String userName,
String name)
Deletes the specified user variable. |
void |
destroyRoom(int zoneId,
int roomId)
Destroys the room specified by the room and zone IDs. |
void |
disableAllLogins()
Disables users from logging in. |
void |
enableLogins()
Allows users to start logging in again, after disableAllLogins was previously used. |
void |
evictUserFromServer(String userName,
EsObjectRO reason)
Synchronously evict a user from the system. |
FindGamesWithBuddiesResponse |
findAllGamesWithBuddies(String userName,
String gameType,
EsObject gameDetails)
Finds games being played by any buddies of the specified user. |
protected com.electrotank.electroserver5.entities.GameRO[] |
findGames(com.electrotank.electroserver5.entities.SearchCriteria criteria)
|
com.electrotank.electroserver5.entities.GameRO[] |
findGames(String gameType,
boolean locked,
EsObject gameDetails)
Returns an array of current games that match the criteria given. |
com.electrotank.electroserver5.entities.GameRO[] |
findGames(String gameType,
EsObject gameDetails)
Returns an array of current games that match the criteria given, whether the games are locked or not. |
com.electrotank.electroserver5.entities.GameRO |
findOneGameWithBuddies(String userName,
String gameType,
EsObject gameDetails)
Finds one game being played by a buddy of the specified user. |
Collection<String> |
getAllConnectedUsers()
Returns a collection of the usernames of all connected users. |
List<String> |
getAllFloodingFilterNames()
Returns a list of all flooding filter names |
List<String> |
getAllLanguageFilterNames()
Returns a list of all language filter names |
List<String> |
getBuddies(String userName)
Gets the specified user's buddy list. |
List<String> |
getBuddiesOnline(String userName)
Gets the specified user's buddy list, filtered to show only those buddies that are currently online. |
EsObject |
getBuddyEsObject(String userName,
String buddyName)
Gets the optional EsObject associated with a buddy in the specified user's buddy list. |
Collection<String> |
getConnectedUsers()
Gets a list of the usernames of all users currently logged in. |
Object |
getExtensionBoundServerVariable(Object key)
Get the ExtensionBoundServerVariable of this name. |
ExtensionBoundUserServerVariableResponse |
getExtensionBoundUserServerVariable(String userName,
String variableName)
Looks up and returns an extension-bound user server variable. |
String |
getExtensionName()
Used to get the name of the extension that contains this component. |
EsFileSystemApi |
getFileSystemApi()
Used to access the file system API functionality of the server. |
Map<String,Integer> |
getGameCountByType()
Returns the number of current games of each game type registered by GameManager. |
List<String> |
getGameTypesRegistered()
Returns a list of all gameTypes registered with GameManager. |
String |
getHandle()
Used to get the handle of this extension component. |
long |
getIdleMillisecondsForUser(String userName)
Returns the number of milliseconds that the specified user has been idle. |
List<InetAddress> |
getIpForUser(String userName)
Gets a list of IP addresses the user is connecting from or null if the user is not known. |
org.slf4j.Logger |
getLogger()
Acquires a logger for the current component. |
EsObjectRO |
getLogoutReason(String userName)
For use in LogoutEventHandler. |
com.electrotank.electroserver5.enumerations.ErrorType |
getLogoutType(String userName)
For use in LogoutEventHandler. |
String |
getName()
Used to the get the name of this extension component. |
String |
getPermissionSetId(String userName)
Returns the id of the permission set for this user. |
RoomValue |
getRoom(int zoneId,
int roomId)
Gets information about a single room, given the zoneId and roomId. |
int |
getRoomCount()
Get the total number of active rooms in all zones. |
List<String> |
getRoomOperators(int zoneId,
int roomId)
Gets a list of all users who have room operator status for the given room. |
Plugin |
getRoomPlugin(int zoneId,
int roomId,
String pluginName)
Used to get a reference to another room plugin based on the zone ID and room ID and plugin name. |
Collection<RoomValue> |
getRooms(int zoneId,
String roomName)
Gets information about all rooms in the zone specified that have the specified room name. |
Collection<RoomValue> |
getRooms(String zoneName,
int roomId)
Gets information about all rooms with the specified roomId that are in a zone with the specified zone name. |
Collection<RoomValue> |
getRooms(String zoneName,
String roomName)
Gets information about all rooms with the specified room name that are in a zone with the specified zone name. |
Collection<RoomValue> |
getRoomsInZone(int zoneId)
Looks up and returns all the rooms in a given zone. |
Collection<RoomValue> |
getRoomsInZoneByName(String zoneName)
Looks up and returns all the rooms in a given zone. |
ReadOnlyRoomVariable |
getRoomVariable(int zoneId,
int roomId,
String name)
Looks up and returns a specific room variable. |
Collection<ReadOnlyRoomVariable> |
getRoomVariables(int zoneId,
int roomId)
Looks up and returns all room variables in a given room. |
Plugin |
getServerPlugin(String pluginName)
Used to get a reference to a server level plugin in the same extension, based on the plugin name. |
long |
getServerUptime()
Get the number of milliseconds since the server was started. |
String |
getServerUptimeString()
Get the number of days, hours and minutes since the server was started, formatted as a string y:DDD:HH:mm. |
String |
getServerVersion()
Get the server version. |
UserValue |
getUser(String userName)
Used to return details on the specified user. |
protected com.electrotank.electroserver5.entities.User |
getUserByUserName(String userName)
|
String |
getUserClientType(String userName)
Gets a String representing the type of client a given user has, such as 'ActionScript3', 'CSharpUnity', etc. |
String |
getUserClientVersion(String userName)
Gets the version of the client api that a given user's client used, such as '5.3.2'. |
int |
getUserCount()
Get the number of users currently logged in. |
int |
getUserCountByGameType(String gameType,
boolean distinct)
Get the number of users playing a certain game (specified by the gameType). |
int |
getUserCountByZoneId(int zoneId,
boolean distinct)
Get the number of users in a given zone. |
int |
getUserCountByZoneName(String zoneName,
boolean distinct)
Get the number of users in a given zone. |
protected com.electrotank.electroserver5.entities.ConnectedUser |
getUserFromName(String userName)
|
protected long |
getUserIdFromName(String userName)
|
int |
getUserIdleDisconnectTimeSeconds()
Returns the value of the Client Idle Disconnect Time from the ES Admin. |
int |
getUserIdleWarningTimeMS(String userName)
Returns the value of the Client Idle Warning Time for the specified user, in milliseconds. |
protected Collection<Long> |
getUserIdsFromNameList(Collection<String> userNames)
|
List<com.electrotank.electroserver5.entities.GameRO> |
getUserJoinedGames(String userName)
Returns a Collection of games that the specified user is currently joined to. |
List<RoomValue> |
getUserJoinedRooms(String userName)
Returns a Collection of rooms that the specified user is currently joined to. |
UserServerVariableResponse |
getUserServerVariable(String userName,
String variableName)
Looks up and returns a user server variable. |
Collection<ReadOnlyUserServerVariable> |
getUserServerVariables(String userName)
Looks up and returns all the user server variables for a given user. |
protected Collection<com.electrotank.electroserver5.entities.ConnectedUser> |
getUsersFromNameList(Collection<String> userNames)
|
Collection<UserValue> |
getUsersInRoom(int zoneId,
int roomId)
Looks up and returns all the users in a given room. |
ReadOnlyUserVariable |
getUserVariable(String userName,
String name)
Looks up and returns a specific user variable. |
Collection<ReadOnlyUserVariable> |
getUserVariables(String userName)
Looks up and returns all the user variables for a given user. |
int |
getZoneCount()
Get the number of active zones. |
Collection<ZoneValue> |
getZones()
Looks up and returns all the zones on the server. |
PluginApiResponse |
grantOperatorStatus(String userName,
int zoneId,
int roomId)
Grants room operator status to the given user for the specified room. |
boolean |
isBuddy(String userName,
String buddyName)
Determines whether the specified user is buddies with buddyName. |
boolean |
isRoomOperator(String userName,
int zoneId,
int roomId)
Returns true if the given user has room operator status for the specified room. |
boolean |
isSuppressBuddyEventsForUser(String userName)
Returns a boolean indicating whether this user's buddy events are suppressed. |
boolean |
isUserLoggedIn(String userName)
Determines if a user is currently logged in or not. |
GameManagerResponse |
joinUserToGame(int gameId,
String username,
String password)
Joins a single user to an existing game, given the gameId and the password. |
void |
kickAllUsers()
Kicks all connected users off the server. |
void |
kickUserFromRoom(String userName,
int zoneId,
int roomId,
String reason)
Used to kick a user from a room with a specified message. |
void |
kickUserFromServer(String userName,
EsObjectRO reason)
Used to kick a user from the server directly. |
RoomResponse |
liftRoomBanForUser(String userName,
int zoneId,
int roomId)
Removes a ban on a specified user, for a specified room. |
void |
putExtensionBoundServerVariable(Object key,
Object variable)
Add or update the ExtensionBoundServerVariable of this name. |
GameManagerResponse |
quickJoinGameForUser(String userName,
String gameType,
String zoneName,
EsObject gameDetails)
Used to do a quick join game for the identified user. |
GameManagerResponse |
quickJoinGameWithBuddyForUser(String userName,
String gameType,
String zoneName,
EsObject gameDetails)
Used to do a quick join game for the identified user, with preference given to a game that has a buddy in it. |
void |
registerGameConfiguration(String gameType,
GameConfiguration configuration)
Used to register a GameConfiguration with the server so that it can be used in conjunction with the GameManager. |
void |
releaseManagedObject(String factoryName,
Object object)
Releases a managed object back to the specified factory. |
boolean |
removeBuddy(String userName,
String buddyName)
Removes a buddy from the specified user's buddy list. |
void |
restartServer()
Restarts the ES5 server, as if the restart button on the ES Admin were clicked. |
void |
resumeIdleKickingForUser(String userName)
Enables kicking for idleness for the specified user. |
PluginApiResponse |
revokeOperatorStatus(String userName,
int zoneId,
int roomId)
Revokes room operator status to the given user for the specified room. |
int |
scheduleExecution(int interval,
int numberOfTimes,
ScheduledCallback callback)
Schedules execution of the callback's method at the defined interval. |
int |
scheduleExecutionFromScript(int interval,
int numberOfTimes,
String callbackName)
Schedules execution of the callback's method at the defined interval. |
void |
sendCreateOrJoinGameResponse(String userName,
GameManagerResponse response)
Sends a CreateOrJoinGameResponse to the specified user, based on the GameManagerResponse. |
int |
sendGlobalPluginMessage(EsObjectRO variables)
Sends a plugin message to every connected user, whether in a room or not. |
int |
sendGlobalPrivateMessage(String message)
Sends a private message to every connected user, whether in a room or not. |
PluginPublicMessageResponse |
sendPluginMessageToRoom(int zoneId,
int roomId,
EsObjectRO variables)
Sends a plugin message to all users in a room. |
PluginPublicMessageResponse |
sendPluginMessageToRoom(int zoneId,
int roomId,
com.electrotank.electroserver5.messages.Message.Reliability reliability,
EsObjectRO variables)
|
PluginPublicMessageResponse |
sendPluginMessageToRooms(Map<Integer,Collection<Integer>> zoneRoomCombos,
EsObjectRO variables)
Sends a plugin message to a group of rooms. |
PluginPublicMessageResponse |
sendPluginMessageToServer(EsObjectRO variables)
Sends a plugin message to the entire server. |
PluginPrivateMessageResponse |
sendPluginMessageToUser(String userName,
EsObjectRO variables)
Sends a plugin message to a user. |
PluginPrivateMessageResponse |
sendPluginMessageToUser(String userName,
com.electrotank.electroserver5.messages.Message.Reliability reliability,
EsObjectRO variables)
Sends a plugin message to a user. |
PluginPrivateMessageResponse |
sendPluginMessageToUsers(Collection<String> userNames,
EsObjectRO variables)
Sends a plugin message to a group of users. |
PluginPrivateMessageResponse |
sendPluginMessageToUsers(String[] userNames,
EsObjectRO variables)
Sends a plugin message to a group of users. |
PluginPublicMessageResponse |
sendPluginMessageToZone(int zoneId,
EsObjectRO variables)
Sends a plugin message to all users in a zone. |
PluginPublicMessageResponse |
sendPluginMessageToZones(Collection<Integer> zoneIds,
EsObjectRO variables)
Sends a plugin message to a group of zones. |
PluginPublicMessageResponse |
sendPluginMessageToZones(int[] zoneIds,
EsObjectRO variables)
Sends a plugin message to a group of zones. |
PluginPrivateMessageResponse |
sendPrivateMessageToUserFromPlugin(String fromName,
String toName,
String message,
EsObject esObject,
boolean executePrivateMessageEventHandlers)
Sends a private chat message to the specified user, marked as coming from the specified userName. |
PluginPrivateMessageResponse |
sendPrivateMessageToUsersFromPlugin(String fromName,
String[] toNames,
String message,
EsObject esObject,
boolean executePrivateMessageEventHandlers)
Sends a private chat message to the specified array of users, marked as coming from the specified userName. |
PluginApiResponse |
sendPublicMessageToRoomFromPlugin(String userName,
int zoneId,
int roomId,
String message,
EsObject esObject,
boolean executePublicMessageEventHandlers,
boolean executePluginUserSendPublicMessage)
Sends a public message to the specified room, marked as coming from the specified userName. |
void |
setAutoIdleKickingForUser(String userName,
boolean value)
When set to true, this will automatically resume idle kicking for the specified user, as soon as the client sends a message to the server. |
ExtensionBoundUserServerVariableResponse |
setExtensionBoundUserServerVariable(String userName,
String variableName,
Object variableValue)
Sets an extension-bound user server variable on a given user. |
void |
setPermissionSetId(String userName,
String id)
Sets the permission set id for a given user. |
void |
setSuppressBuddyEventsForUser(String userName,
boolean value)
Sets suppression of buddy events for the given user. |
void |
setUserIdleWarningTimeMS(String userName,
int durationMS)
Sets the value of the Client Idle Warning Time for the specified user, in milliseconds. |
UserServerVariableResponse |
setUserServerVariable(String userName,
String variableName,
EsObject variableValue)
Sets a user server variable on a given user. |
void |
shutdownServer()
Shuts down the ES5 server, as if the shutdown button on the ES Admin were clicked. |
void |
suspendIdleKickingForUser(String userName)
Disables kicking for idleness for the specified user. |
void |
unregisterGameConfiguration(String gameType,
boolean clearGamesByType)
Removes a GameConfiguration from the GameManager, so that users can no longer create games of this gameType. |
RoomVariableResponse |
updateRoomVariable(int zoneId,
int roomId,
String name,
boolean valueUpdated,
EsObject value,
boolean lockStatusUpdated,
boolean locked)
Updates the specified room variable. |
Long |
userIdForName(String userName)
Get the internal user ID for the specified user name |
String |
userNameForId(long userId)
Get the user name for the specified user ID |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final com.electrotank.electroserver5.entities.managers.ExtensionManager extensionManager
| Constructor Detail |
|---|
public ElectroServerApiImpl(com.electrotank.electroserver5.entities.BaseBridge bridge,
com.electrotank.electroserver5.servers.registry.GatewaySender gateways,
com.electrotank.electroserver5.entities.managers.RoomManager roomManager,
com.electrotank.electroserver5.entities.People people,
ScheduledExecutorService scheduledExecutorService,
com.electrotank.electroserver5.entities.managers.LanguageFilterManager languageFilterManager,
EsFileSystemApi fileSystem,
com.electrotank.electroserver5.entities.managers.GameManager gameManager,
com.electrotank.electroserver5.entities.managers.BuddyListManager buddyListManager,
com.electrotank.electroserver5.entities.managers.UserEventManager eventManager,
com.electrotank.electroserver5.entities.managers.ExtensionManager extensionManager)
bridge - gateways - roomManager - people - scheduledExecutorService - languageFilterManager - fileSystem - gameManager - buddyListManager - eventManager - | Method Detail |
|---|
public boolean addBuddy(String userName,
String buddyName,
EsObjectRO esObject)
ElectroServerApi
addBuddy in interface ElectroServerApiuserName - user name of the user whose buddy list the buddy should be addedbuddyName - user name of the buddy to be addedesObject - optional meta-data to be associated with the buddy
removeBuddy
public boolean removeBuddy(String userName,
String buddyName)
ElectroServerApi
removeBuddy in interface ElectroServerApiuserName - user name of the user whose buddy list the buddy should be removedbuddyName - user name of the buddy to be removed
addBuddy,
EsObject
public LanguageFilterResponse applyLanguageFilterToString(String languageFilterName,
String stringToTest)
ElectroServerApi
applyLanguageFilterToString in interface ElectroServerApilanguageFilterName - the name of the language filter to invokestringToTest - the string to test with the selected langauge filter
LanguageFilterResponsepublic org.slf4j.Logger getLogger()
ElectroServerApiAcquires a logger for the current component. The logger returned is an interface in the SLF4J framework. Javadocs for the Logger interface can be found here: http://www.slf4j.org/api/org/slf4j/Logger.html
The logging framework for extensions allows for a great deal of flexibility. When getLogger is called, it returns a Logger interface with a custom logger hierarchy. The format of the hierarchy looks like this: Extensions.<extension_name>.<component_type>.<component_handle> Component types will be "ManagedObjectFactories", "Plugins", or "EventHandlers". So a specific example might be: Extensions.MyGameExtension.Plugins.MyGamePlugin
By configuring the logging configuration file in the server config directory, the developer has complete control over the logging levels and ouput format of log messages for all extensions, or individual extensions or even single components.
getLogger in interface ElectroServerApi
public PluginPrivateMessageResponse sendPluginMessageToUser(String userName,
EsObjectRO variables)
ElectroServerApi
sendPluginMessageToUser in interface ElectroServerApiuserName - the name of the uservariables - the EsObject to send as part of the message
sendPluginMessageToRoom,
sendPluginMessageToRooms,
sendPluginMessageToServer,
sendPluginMessageToUsers,
sendPluginMessageToZone,
sendPluginMessageToZones,
PluginPublicMessageResponse,
EsObjectRO
public PluginPrivateMessageResponse sendPluginMessageToUser(String userName,
com.electrotank.electroserver5.messages.Message.Reliability reliability,
EsObjectRO variables)
ElectroServerApi
sendPluginMessageToUser in interface ElectroServerApiuserName - the name of the uservariables - the EsObject to send as part of the message
sendPluginMessageToRoom,
sendPluginMessageToRooms,
sendPluginMessageToServer,
sendPluginMessageToUsers,
sendPluginMessageToZone,
sendPluginMessageToZones,
PluginPublicMessageResponse,
EsObjectRO
public PluginPrivateMessageResponse sendPluginMessageToUsers(String[] userNames,
EsObjectRO variables)
ElectroServerApi
sendPluginMessageToUsers in interface ElectroServerApiuserNames - an array of user names that should receive this mesagevariables - the EsObject to send as part of the message
sendPluginMessageToRoom,
sendPluginMessageToRooms,
sendPluginMessageToServer,
sendPluginMessageToUser,
sendPluginMessageToZone,
sendPluginMessageToZones,
PluginPublicMessageResponse,
EsObjectRO
public PluginPrivateMessageResponse sendPluginMessageToUsers(Collection<String> userNames,
EsObjectRO variables)
ElectroServerApi
sendPluginMessageToUsers in interface ElectroServerApiuserNames - a Collection of user names that should receive this mesagevariables - the EsObject to send as part of the message
sendPluginMessageToRoom,
sendPluginMessageToRooms,
sendPluginMessageToServer,
sendPluginMessageToUser,
sendPluginMessageToZone,
sendPluginMessageToZones,
PluginPublicMessageResponse,
EsObjectROpublic PluginPublicMessageResponse sendPluginMessageToServer(EsObjectRO variables)
ElectroServerApi
sendPluginMessageToServer in interface ElectroServerApivariables - the EsObject to send as part of the message
sendPluginMessageToRoom,
sendPluginMessageToRooms,
sendPluginMessageToUser,
sendPluginMessageToUsers,
sendPluginMessageToZone,
sendPluginMessageToZones,
sendGlobalPrivateMessage,
sendGlobalPluginMessage,
PluginPublicMessageResponse,
EsObjectRO
public PluginPublicMessageResponse sendPluginMessageToZone(int zoneId,
EsObjectRO variables)
ElectroServerApi
sendPluginMessageToZone in interface ElectroServerApizoneId - the zone IDvariables - the EsObject to send as part of the message
sendPluginMessageToRoom,
sendPluginMessageToRooms,
sendPluginMessageToServer,
sendPluginMessageToUser,
sendPluginMessageToUsers,
sendPluginMessageToZones,
PluginPublicMessageResponse,
EsObjectRO
public PluginPublicMessageResponse sendPluginMessageToZones(int[] zoneIds,
EsObjectRO variables)
ElectroServerApi
sendPluginMessageToZones in interface ElectroServerApizoneIds - an array of zone IDsvariables - the EsObject to send as part of the message
sendPluginMessageToRoom,
sendPluginMessageToRooms,
sendPluginMessageToServer,
sendPluginMessageToUser,
sendPluginMessageToUsers,
sendPluginMessageToZone,
PluginPublicMessageResponse,
EsObjectRO
public PluginPublicMessageResponse sendPluginMessageToZones(Collection<Integer> zoneIds,
EsObjectRO variables)
ElectroServerApi
sendPluginMessageToZones in interface ElectroServerApizoneIds - a Collection of zone IDsvariables - the EsObject to send as part of the message
sendPluginMessageToRoom,
sendPluginMessageToRooms,
sendPluginMessageToServer,
sendPluginMessageToUser,
sendPluginMessageToUsers,
sendPluginMessageToZone,
PluginPublicMessageResponse,
EsObjectRO
public PluginPublicMessageResponse sendPluginMessageToRoom(int zoneId,
int roomId,
com.electrotank.electroserver5.messages.Message.Reliability reliability,
EsObjectRO variables)
sendPluginMessageToRoom in interface ElectroServerApi
public PluginPublicMessageResponse sendPluginMessageToRoom(int zoneId,
int roomId,
EsObjectRO variables)
ElectroServerApi
sendPluginMessageToRoom in interface ElectroServerApizoneId - the zone IDroomId - the room IDvariables - the EsObject to send as part of the message
sendPluginMessageToRooms,
sendPluginMessageToServer,
sendPluginMessageToUser,
sendPluginMessageToUsers,
sendPluginMessageToZone,
sendPluginMessageToZones,
PluginPublicMessageResponse,
EsObjectRO
public PluginPublicMessageResponse sendPluginMessageToRooms(Map<Integer,Collection<Integer>> zoneRoomCombos,
EsObjectRO variables)
ElectroServerApi
sendPluginMessageToRooms in interface ElectroServerApizoneRoomCombos - a map containing the zone ID as a key tied to a list of room IDsvariables - the EsObject to send as part of the message
sendPluginMessageToRoom,
sendPluginMessageToServer,
sendPluginMessageToUser,
sendPluginMessageToUsers,
sendPluginMessageToZone,
sendPluginMessageToZones,
PluginPublicMessageResponse,
EsObjectRO
public RoomResponse createRoomInNamedZone(String zoneName,
boolean joinExistingZone,
RoomConfiguration roomConfig,
UserConfig[] userConfigs)
ElectroServerApi
createRoomInNamedZone in interface ElectroServerApizoneName - the zone namejoinExistingZone - boolean indicating if the room should join an existing zone if it existsroomConfig - the room configuration to use for this new roomuserConfigs - the configuration of users to join this room
createRoom,
destroyRoom,
RoomResponse,
RoomConfiguration,
UserConfig
public RoomResponse createRoomInNamedZone(String zoneName,
boolean joinExistingZone,
RoomConfiguration roomConfig,
Collection<UserConfig> userConfigs)
ElectroServerApi
createRoomInNamedZone in interface ElectroServerApizoneName - the zone namejoinExistingZone - boolean indicating if the room should join an existing zone if it existsroomConfig - the room configuration to use for this new roomuserConfigs - the configuration of users to join this room
createRoom,
destroyRoom,
RoomResponse,
RoomConfiguration,
UserConfig
public RoomResponse createRoom(int zoneId,
RoomConfiguration roomConfig,
UserConfig[] userConfigs)
ElectroServerApi
createRoom in interface ElectroServerApizoneId - the zone idroomConfig - the room configuration to use for this new roomuserConfigs - the configuration of users to join this room
createRoomInNamedZone,
destroyRoom,
RoomResponse,
RoomConfiguration,
UserConfig
public RoomResponse createRoom(int zoneId,
RoomConfiguration roomConfig,
Collection<UserConfig> userConfigs)
ElectroServerApi
createRoom in interface ElectroServerApizoneId - the zone idroomConfig - the room configuration to use for this new roomuserConfigs - the configuration of users to join this room
createRoomInNamedZone,
destroyRoom,
RoomResponse,
RoomConfiguration,
UserConfig
public void destroyRoom(int zoneId,
int roomId)
ElectroServerApi
destroyRoom in interface ElectroServerApizoneId - the zone IDroomId - the room IDcreateRoom,
createRoomInNamedZone
public RoomResponse addUsersToRoom(int zoneId,
int roomId,
String password,
UserConfig[] userConfigs)
ElectroServerApi
addUsersToRoom in interface ElectroServerApizoneId - zone ID for the specific roomroomId - room ID for the specific roompassword - password of the roomuserConfigs - configuration array of the users to join the specified room
RoomResponse,
UserConfig
public RoomResponse addUsersToRoom(int zoneId,
int roomId,
String password,
Collection<UserConfig> userConfigs)
ElectroServerApi
addUsersToRoom in interface ElectroServerApizoneId - zone ID for the specific roomroomId - room ID for the specific roompassword - password of the roomuserConfigs - configuration collection of the users to join the specified room
RoomResponse,
UserConfig
public RoomVariableResponse createRoomVariable(int zoneId,
int roomId,
String name,
EsObject value,
boolean locked)
ElectroServerApi
createRoomVariable in interface ElectroServerApizoneId - the zone IDroomId - the room IDname - the name of the variablevalue - the value of the variablelocked - a boolean indicating if the variable is locked or not
createRoomVariableForUser,
updateRoomVariable,
deleteRoomVariable,
RoomVariableResponse,
EsObject
public RoomVariableResponse createRoomVariableForUser(int zoneId,
int roomId,
String name,
EsObject value,
boolean locked,
String username,
boolean persistent)
ElectroServerApi
createRoomVariableForUser in interface ElectroServerApizoneId - the zone IDroomId - the room IDname - the name of the variablevalue - the value of the variablelocked - a boolean indicating if the variable is locked or notusername - name of the user tied to the variablepersistent - is this a persistent variable
createRoomVariable,
updateRoomVariable,
deleteRoomVariable,
RoomVariableResponse,
EsObject
public RoomVariableResponse updateRoomVariable(int zoneId,
int roomId,
String name,
boolean valueUpdated,
EsObject value,
boolean lockStatusUpdated,
boolean locked)
ElectroServerApi
updateRoomVariable in interface ElectroServerApizoneId - the zone IDroomId - the room IDname - the name of the variablevalueUpdated - a boolean indicating if the variable was updatedvalue - the value of the variablelockStatusUpdated - a boolean indicating if the lock has been changedlocked - the value of the lock
createRoomVariable,
createRoomVariableForUser,
deleteRoomVariable,
RoomVariableResponse,
EsObject
public RoomVariableResponse deleteRoomVariable(int zoneId,
int roomId,
String name)
ElectroServerApi
deleteRoomVariable in interface ElectroServerApizoneId - the zone IDroomId - the room IDname - the name of the variable
createRoomVariable,
createRoomVariableForUser,
updateRoomVariable,
RoomVariableResponse
public Collection<ReadOnlyRoomVariable> getRoomVariables(int zoneId,
int roomId)
ElectroServerApi
getRoomVariables in interface ElectroServerApizoneId - the zone IDroomId - the room ID
getRoomVariable,
ReadOnlyRoomVariable
public ReadOnlyRoomVariable getRoomVariable(int zoneId,
int roomId,
String name)
ElectroServerApi
getRoomVariable in interface ElectroServerApizoneId - the zone IDroomId - the room IDname - the variable name
getRoomVariables,
ReadOnlyRoomVariable
public UserVariableResponse createOrUpdateUserVariable(String userName,
String name,
EsObject value)
ElectroServerApiLoginEventHandler.
createOrUpdateUserVariable in interface ElectroServerApiuserName - the user namename - the variable namevalue - the variable value
deleteUserVariable,
getUserVariable,
getUserVariables,
UserVariableResponse,
EsObject
public UserVariableResponse deleteUserVariable(String userName,
String name)
ElectroServerApiLoginEventHandler.
deleteUserVariable in interface ElectroServerApiuserName - the user namename - the variable name
createOrUpdateUserVariable,
getUserVariable,
getUserVariables,
UserVariableResponsepublic Collection<ReadOnlyUserVariable> getUserVariables(String userName)
ElectroServerApiLoginEventHandler.
getUserVariables in interface ElectroServerApiuserName - the user name
getUserVariable,
ReadOnlyUserVariable
public ReadOnlyUserVariable getUserVariable(String userName,
String name)
ElectroServerApiLoginEventHandler.
getUserVariable in interface ElectroServerApiuserName - the user namename - the variable name
getUserVariables,
ReadOnlyUserVariablepublic Collection<ZoneValue> getZones()
ElectroServerApi
getZones in interface ElectroServerApiZoneValuepublic Collection<RoomValue> getRoomsInZone(int zoneId)
ElectroServerApi
getRoomsInZone in interface ElectroServerApizoneId - the zone ID
getRoomsInZoneByName,
RoomValuepublic Collection<RoomValue> getRoomsInZoneByName(String zoneName)
ElectroServerApi
getRoomsInZoneByName in interface ElectroServerApizoneName - the zone name
getRoomsInZone,
RoomValue
public Collection<UserValue> getUsersInRoom(int zoneId,
int roomId)
ElectroServerApi
getUsersInRoom in interface ElectroServerApizoneId - the zone IDroomId - the room ID
getUser,
UserValuepublic UserValue getUser(String userName)
ElectroServerApi
getUser in interface ElectroServerApiuserName - the name of the user
getUsersInRoom,
UserValuepublic List<InetAddress> getIpForUser(String userName)
ElectroServerApi
getIpForUser in interface ElectroServerApiuserName - the user's name
public UserServerVariableResponse getUserServerVariable(String userName,
String variableName)
ElectroServerApiLoginEventHandler.
getUserServerVariable in interface ElectroServerApiuserName - the user namevariableName - the variable name
setUserServerVariable,
deleteUserServerVariable,
UserServerVariableResponse
public UserServerVariableResponse setUserServerVariable(String userName,
String variableName,
EsObject variableValue)
ElectroServerApiLoginEventHandler.
setUserServerVariable in interface ElectroServerApiuserName - the user namevariableName - the variable namevariableValue - the variable value
getUserServerVariable,
deleteUserServerVariable,
UserServerVariableResponse,
EsObject
public UserServerVariableResponse deleteUserServerVariable(String userName,
String variableName)
ElectroServerApiLoginEventHandler.
deleteUserServerVariable in interface ElectroServerApiuserName - the user namevariableName - the variable name
getUserServerVariable,
setUserServerVariable,
UserServerVariableResponse
public ExtensionBoundUserServerVariableResponse getExtensionBoundUserServerVariable(String userName,
String variableName)
ElectroServerApiLoginEventHandler.
getExtensionBoundUserServerVariable in interface ElectroServerApiuserName - the user namevariableName - the variable name
setExtensionBoundUserServerVariable,
deleteExtensionBoundUserServerVariable,
ExtensionBoundUserServerVariableResponse
public ExtensionBoundUserServerVariableResponse setExtensionBoundUserServerVariable(String userName,
String variableName,
Object variableValue)
ElectroServerApiLoginEventHandler.
setExtensionBoundUserServerVariable in interface ElectroServerApiuserName - the user namevariableName - the variable namevariableValue - the variable value
getExtensionBoundUserServerVariable,
deleteExtensionBoundUserServerVariable,
ExtensionBoundUserServerVariableResponse
public ExtensionBoundUserServerVariableResponse deleteExtensionBoundUserServerVariable(String userName,
String variableName)
ElectroServerApiLoginEventHandler.
deleteExtensionBoundUserServerVariable in interface ElectroServerApiuserName - the user namevariableName - the variable name
getExtensionBoundUserServerVariable,
setExtensionBoundUserServerVariable,
ExtensionBoundUserServerVariableResponseprotected long getUserIdFromName(String userName)
protected Collection<Long> getUserIdsFromNameList(Collection<String> userNames)
protected Collection<com.electrotank.electroserver5.entities.ConnectedUser> getUsersFromNameList(Collection<String> userNames)
public boolean isUserLoggedIn(String userName)
ElectroServerApi
isUserLoggedIn in interface ElectroServerApiuserName - the users name
public Object getExtensionBoundServerVariable(Object key)
ElectroServerApi
getExtensionBoundServerVariable in interface ElectroServerApikey - - name of the variable
public void putExtensionBoundServerVariable(Object key,
Object variable)
ElectroServerApi
putExtensionBoundServerVariable in interface ElectroServerApikey - - name of the variablevariable - - variable to be stored
public Object acquireManagedObject(String factoryName,
EsObjectRO parameters)
ElectroServerApiAcquires a managed object from the specified managed object factory. Any code using this method will be limited to managed object factories defined in the same extension as this component. Managed object factories are not accessible across extensions because they return raw objects rather then safer objects (like EsObject) - see the ElectroServer 4 Manual for an overview of the class loader proces and why separation of extensions is required.
The parameters object will be passed directly to the managed object factory. In practice, it is used to provide additional information to the factory in helping it return the appropriate object. A good example might be a connection pooling factory and the parameters object contains the name of the pool to use.
acquireManagedObject in interface ElectroServerApifactoryName - name of the managed object factory as it is defined in the specific extension.xml file.parameters - optional EsObject that will be passed
releaseManagedObject,
ManagedObjectFactory,
EsObject,
ElectroServer 4 Manual
public void releaseManagedObject(String factoryName,
Object object)
ElectroServerApi
releaseManagedObject in interface ElectroServerApifactoryName - the factory's nameobject - the object to releaseacquireManagedObject,
ManagedObjectFactory,
EsObject,
ElectroServer 4 Manual
public Plugin getRoomPlugin(int zoneId,
int roomId,
String pluginName)
ElectroServerApi
Used to get a reference to another room plugin based on the zone ID and room ID
and plugin name. This can be used as a clean replacement for the Plugin Interop
ability. Once the plugin reference is available, the plugin can get cast to its
original type allowing for direct calls to be made.
NOTE: This can only be called from a Java plugin to access another Java plugin from the same extension.
getRoomPlugin in interface ElectroServerApizoneId - the zone IDroomId - the room IDpluginName - the name of the plugin
getServerPlugin,
Plugin
public void kickUserFromRoom(String userName,
int zoneId,
int roomId,
String reason)
ElectroServerApi
kickUserFromRoom in interface ElectroServerApiuserName - the name of the user to kickzoneId - the zone IDroomId - the ID of the room containing the userreason - the reason the user was kickedbanUserFromRoom,
kickUserFromServer
public void banUserFromRoom(String userName,
int zoneId,
int roomId,
int duration,
String reason)
ElectroServerApiUsed to kick and ban a user from a room with a specified message. When invoked, the user specified will recieve the message as part of the ban message from the server. Any users in the room will also be notified that the user was banned along with the message.
In addition to being kicked, the user is unable to re-enter the room until the specified duration has elapsed. Duration is measured in seconds.
banUserFromRoom in interface ElectroServerApiuserName - the name of the user to kickzoneId - the zone IDroomId - the ID of the room containing the userduration - (seconds) how long the user should be banned or -1 for an indefinite banreason - the reason the user was kickedkickUserFromRoom,
kickUserFromServer
public void kickUserFromServer(String userName,
EsObjectRO reason)
ElectroServerApi
kickUserFromServer in interface ElectroServerApiuserName - the name of the user to kickreason - the reason the user was kickedkickUserFromRoom,
banUserFromRoom
public void evictUserFromServer(String userName,
EsObjectRO reason)
ElectroServerApi
evictUserFromServer in interface ElectroServerApiuserName - the name of the user to evictreason - the reason the user was evictedElectroServerApi.kickUserFromServer(String, EsObjectRO)public Plugin getServerPlugin(String pluginName)
ElectroServerApiUsed to get a reference to a server level plugin in the same extension,
based on the plugin name. This can be used as a clean replacement for the Plugin Interop
ability. Once the plugin reference is available, the plugin can get cast to its
original type allowing for direct calls to be made.
NOTE: This can only be called from a Java plugin to access another Java plugin from the same extension.
getServerPlugin in interface ElectroServerApipluginName - the name of the server-level plugin
getRoomPlugin,
Plugin
public EsObject callServerPlugin(String pluginName,
EsObjectRO parameters)
ElectroServerApiUsed to invoke the
interop
method on the designated server-level plugin. This method is the
primary way for a plugin to interact with another plugin in a different extension.
While this can be used with plugins in the same extension, it's simpler to use the
getRoomPlugin or getServerPlugin methods unless script plugins are involved (see
the note on those methods for details).
The designated plugin must implement the
PluginInterop
interface or extend a base
class that does this already (like
BasePlugin).
Note: This can be used to send data between script and Java plugins.
callServerPlugin in interface ElectroServerApipluginName - the plugin nameparameters - the parameters to pass to the "interop" method of the plugin
callRoomPlugin,
getRoomPlugin,
getServerPlugin,
BasePlugin,
PluginInterop,
EsObject
public EsObject callRoomPlugin(int zoneId,
int roomId,
String pluginName,
EsObjectRO parameters)
ElectroServerApiUsed to invoke the
interop
method on the designated server-level plugin. This method is the
primary way for a plugin to interact with another plugin in a different extension.
While this can be used with plugins in the same extension, it's simpler to use the
getRoomPlugin or getServerPlugin methods unless script plugins are involved (see
the note on those methods for details).
The designated plugin must implement the
PluginInterop
interface or extend a base
class that does this already (like
BasePlugin).
Note: This can be used to send data between script and Java plugins.
callRoomPlugin in interface ElectroServerApizoneId - the zone IDroomId - the room IDpluginName - the name of the pluginparameters - the parameters to pass to the "interop" method of the plugin
callServerPlugin,
getRoomPlugin,
getServerPlugin,
BasePlugin,
PluginInterop,
EsObject
public void callUrl(String url,
boolean isPOST,
Map<String,String> parameters,
HttpCallback callback)
ElectroServerApiHttpResults object. This object contains a variety of methods to interact with the
data directly as bytes, convert it to a string, or to even parse the results into a
name/value pair map (like LoadVars in Flash).
callUrl in interface ElectroServerApiurl - address of the page to callisPOST - true if sending a POST request, false if sending a GET requestparameters - map of name/value parameters to the be sent to the address. Ignored for GET requestscallback - callback to be invoked once this method completes either successfully or notblockAndCallUrl,
callUrlFromScript,
HttpResults,
HttpCallback
public void callUrlFromScript(String url,
boolean isPOST,
Map<String,String> parameters,
String callbackName)
ElectroServerApiHttpResults object. This object contains a
variety of methods to interact with the data directly as bytes, convert it to a
string, or to even parse the results into a name/value pair map (like LoadVars
in Flash).
NOTE: THIS IS ONLY CALLABLE FROM A SCRIPT COMPONENT!
callUrlFromScript in interface ElectroServerApiurl - address of the page to callisPOST - true if sending a POST request, false if sending a GET requestparameters - map of name/value parameters to the be sent to the address. Ignored for GET requestscallbackName - callback to be invoked once this method completes either successfully or notblockAndCallUrl,
callUrl,
HttpResults,
HttpCallback
public HttpResults blockAndCallUrl(String url,
boolean isPOST,
Map<String,String> parameters)
ElectroServerApiHttpResults object.
This object contains a variety of methods to interact with the
data directly as bytes, convert it to a string, or to even parse the results into a
name/value pair map (like LoadVars in Flash).
blockAndCallUrl in interface ElectroServerApiurl - address of the page to callisPOST - true if sending a POST request, false if sending a GET requestparameters - map of name/value parameters to the be sent to the address. Ignored for GET requests
callUrl,
callUrlFromScript,
HttpResults,
HttpCallback
public int scheduleExecution(int interval,
int numberOfTimes,
ScheduledCallback callback)
ElectroServerApiSchedules execution of the callback's method at the defined interval. The callback will execute the specified number of times before stopping. To execute a callback once, numberOfTimes needs to be set to 1. To execute the callback indefinitely, then numberOfTimes should be set to -1. The first execution will occur after the interval has passed. All subsequent executions will occur after the interval has passed. The interval's duration is measured in milliseconds.
This method uses the server-wide ScheduledExecutorService which shares the global thread pool. This ensures best possible performance and scalability. The global thread pool settings are configurable in the web-based administration console.
This method is designed to respect server lifecycle events. To that end, if the
server stops the extension component for any reason, all scheduled executions are
canceled. The returned ID is used to cancel a scheduled execution directly via the
cancelScheduledExecution method.
For example:
int id = getApi().scheduleExecution(durationInMilliseconds,
numberOfTimesToRepeat,
new ScheduledCallback() {
public void scheduledCallback() {
... lines to be executed ...
}
});
scheduleExecution in interface ElectroServerApiinterval - duration (ms) until the execution is called as well as the duration between subsequent executionsnumberOfTimes - number of times to execute the callback, -1 is used to indicate indefinite executioncallback - callback to invoke on the schedule
scheduleExecutionFromScript,
cancelScheduledExecution
public int scheduleExecutionFromScript(int interval,
int numberOfTimes,
String callbackName)
ElectroServerApiSchedules execution of the callback's method at the defined interval. The callback will execute the specified number of times before stopping. To execute a callback once, numberOfTimes needs to be set to 1. To execute the callback to execute indefinitely, then numberOfTimes should be set to -1. The first execution will occur after the interval has passed. All subsequent executions will occur after the interval has passed. The interval's duration is measured in milliseconds.
This method uses the server-wide ScheduledExecutorService which shares the global thread pool. This ensures best possible performance and scalability. The global thread pool settings are configurable in the web-based administration console.
This method is designed to respect server lifecycle events. To that end, if the
server stops the extension component for any reason, all scheduled executions are
canceled. The returned ID is used to cancel a scheduled execution directly via the
cancelScheduledExecution method.
NOTE: THIS IS ONLY CALLABLE FROM A SCRIPT COMPONENT!
scheduleExecutionFromScript in interface ElectroServerApiinterval - duration (ms) until the execution is called as well as the duration between subsequent executionsnumberOfTimes - number of times to execute the callback. -1 is used to indicate indefinite executioncallbackName - name of the callback method to invoke on the schedule
scheduleExecution,
cancelScheduledExecutionpublic void cancelScheduledExecution(int id)
ElectroServerApi
cancelScheduledExecution in interface ElectroServerApiid - ID of the scheduled execution to cancelscheduleExecution,
scheduleExecutionFromScriptpublic String getName()
ElectroServerApi
getName in interface ElectroServerApipublic String getHandle()
ElectroServerApi
getHandle in interface ElectroServerApipublic String getExtensionName()
ElectroServerApi
getExtensionName in interface ElectroServerApi
public void registerGameConfiguration(String gameType,
GameConfiguration configuration)
ElectroServerApiUsed to register a GameConfiguration with the server so that it can be used in conjunction with the GameManager. Before any game can be created with the GameManager it must be registered. The game type is required to identify the specific game configuration for future calls.
When the GameManager is used to find or create a game, it will use the game type to find the correct GameConfiguration. Then it will use the GameConfiguration to create the specific zone/room configuration the game needs.
For details on using the GameManager, see the ElectroServer 4 Manual, Game Manager.
registerGameConfiguration in interface ElectroServerApigameType - the game type to associate with this configurationconfiguration - the GameConfiguration for this game typeGameConfiguration
public void unregisterGameConfiguration(String gameType,
boolean clearGamesByType)
ElectroServerApi
unregisterGameConfiguration in interface ElectroServerApigameType - to be unregisteredclearGamesByType - true to try to remove the entry from the gamesByType map
public GameManagerResponse createGameForUsers(String gameType,
Collection<String> users,
String zoneName,
String password,
boolean locked,
boolean hidden,
EsObject gameDetails)
ElectroServerApiUsed to directly create a game for the identified users via the GameManager. Once this game is created, it will behave just as though it were created via clients.
The hidden, locked, and gameDetails parameters all relate to the state of the game once creation is complete. Locked is used to prevent users from joining the game once it is created. Hidden is used to show or hide the game from the game list retrieved from the GameManager. GameDetails are used to provide extra information to the GameManager for searching and identifying the game.
For details on using the GameManager, see the ElectroServer 4 Manual, Game Manager.
createGameForUsers in interface ElectroServerApigameType - the game type to createusers - a Collection of users to join to the gamezoneName - the name of the zone in which to create the game room - this zone will be created if neededpassword - the password to establish on the game room, this password will be needed for any users to enter laterlocked - if the game room is to be locked initially (this can be changed later if needed)hidden - if the game room is to be hidden initially (this can be changed later if needed)gameDetails - the custom details of the game that are to be made available to the GameManager (this can be changed later if needed)
GameManagerResponse,
EsObject
public GameManagerResponse createGameForUsers(String gameType,
String[] users,
String zoneName,
String password,
boolean locked,
boolean hidden,
EsObject gameDetails)
ElectroServerApiUsed to directly create a game for the identified users via the GameManager. Once this game is created, it will behave just as though it were created via clients.
The hidden, locked, and gameDetails parameters all relate to the state of the game once creation is complete. Locked is used to prevent users from joining the game once it is created. Hidden is used to show or hide the game from the game list retrieved from the GameManager. GameDetails are used to provide extra information to the GameManager for searching and identifying the game.
For details on using the GameManager, see the ElectroServer 4 Manual, Game Manager.
createGameForUsers in interface ElectroServerApigameType - the game type to createusers - an array of users to join to the gamezoneName - the name of the zone in which to create the game room - this zone will be created if neededpassword - the password to establish on the game room, this password will be needed for any users to enter laterlocked - if the game room is to be locked initially (this can be changed later if needed)hidden - if the game room is to be hidden initially (this can be changed later if needed)gameDetails - the custom details of the game that are to be made available to the GameManager (this can be changed later if needed)
GameManagerResponse,
EsObject
public GameManagerResponse carefullyCreateGameForUsers(String gameType,
Collection<String> users,
String zoneName,
String password,
boolean locked,
boolean hidden,
EsObject gameDetails)
ElectroServerApiUsed to directly create a game for the identified users via the GameManager. Once this game is created, it will behave just as though it were created via clients. This method differs from createGameForUsers in that if one user fails to join the game, the call does not fail at that point, but continues attempting to add users to the game and returns a success if the game was created successfully.
The hidden, locked, and gameDetails parameters all relate to the state of the game once creation is complete. Locked is used to prevent users from joining the game once it is created. Hidden is used to show or hide the game from the game list retrieved from the GameManager. GameDetails are used to provide extra information to the GameManager for searching and identifying the game.
For details on using the GameManager, see the ElectroServer 4 Manual, Game Manager.
carefullyCreateGameForUsers in interface ElectroServerApigameType - the game type to createusers - an array of users to join to the gamezoneName - the name of the zone in which to create the game room - this zone will be created if neededpassword - the password to establish on the game room, this password will be needed for any users to enter laterlocked - if the game room is to be locked initially (this can be changed later if needed)hidden - if the game room is to be hidden initially (this can be changed later if needed)gameDetails - the custom details of the game that are to be made available to the GameManager (this can be changed later if needed)
GameManagerResponse,
EsObject
public GameManagerResponse joinUserToGame(int gameId,
String username,
String password)
ElectroServerApi
joinUserToGame in interface ElectroServerApi
public com.electrotank.electroserver5.entities.GameRO[] findGames(String gameType,
EsObject gameDetails)
ElectroServerApi
findGames in interface ElectroServerApigameType - as registered with GameManagergameDetails - that should match
public com.electrotank.electroserver5.entities.GameRO[] findGames(String gameType,
boolean locked,
EsObject gameDetails)
ElectroServerApi
findGames in interface ElectroServerApigameType - as registered with GameManagerlocked - whether to search for locked games or unlocked gamesgameDetails - that should match
protected com.electrotank.electroserver5.entities.GameRO[] findGames(com.electrotank.electroserver5.entities.SearchCriteria criteria)
protected com.electrotank.electroserver5.entities.ConnectedUser getUserFromName(String userName)
protected com.electrotank.electroserver5.entities.User getUserByUserName(String userName)
public Long userIdForName(String userName)
ElectroServerApi
userIdForName in interface ElectroServerApiuserName - Name of user to get the ID for
public String userNameForId(long userId)
ElectroServerApi
userNameForId in interface ElectroServerApiuserId - ID to get the user name for
public EsFileSystemApi getFileSystemApi()
ElectroServerApi
getFileSystemApi in interface ElectroServerApiEsFileSystemApipublic int getUserCount()
ElectroServerApi
getUserCount in interface ElectroServerApipublic String getServerVersion()
ElectroServerApi
getServerVersion in interface ElectroServerApipublic int getZoneCount()
ElectroServerApi
getZoneCount in interface ElectroServerApipublic int getRoomCount()
ElectroServerApi
getRoomCount in interface ElectroServerApipublic long getServerUptime()
ElectroServerApi
getServerUptime in interface ElectroServerApipublic String getServerUptimeString()
ElectroServerApi
getServerUptimeString in interface ElectroServerApipublic int sendGlobalPrivateMessage(String message)
ElectroServerApi
sendGlobalPrivateMessage in interface ElectroServerApimessage - to be sent
public int sendGlobalPluginMessage(EsObjectRO variables)
ElectroServerApi
sendGlobalPluginMessage in interface ElectroServerApivariables - EsObject to be sent
public List<String> getGameTypesRegistered()
ElectroServerApi
getGameTypesRegistered in interface ElectroServerApipublic List<String> getBuddies(String userName)
ElectroServerApi
getBuddies in interface ElectroServerApi
public boolean isBuddy(String userName,
String buddyName)
ElectroServerApi
isBuddy in interface ElectroServerApi
public EsObject getBuddyEsObject(String userName,
String buddyName)
ElectroServerApi
getBuddyEsObject in interface ElectroServerApipublic List<String> getAllLanguageFilterNames()
ElectroServerApi
getAllLanguageFilterNames in interface ElectroServerApipublic List<String> getAllFloodingFilterNames()
ElectroServerApi
getAllFloodingFilterNames in interface ElectroServerApipublic String getPermissionSetId(String userName)
ElectroServerApi
getPermissionSetId in interface ElectroServerApiuserName - of user
public void setPermissionSetId(String userName,
String id)
ElectroServerApi
setPermissionSetId in interface ElectroServerApiuserName - of userpublic List<String> getBuddiesOnline(String userName)
ElectroServerApi
getBuddiesOnline in interface ElectroServerApi
public GameManagerResponse quickJoinGameWithBuddyForUser(String userName,
String gameType,
String zoneName,
EsObject gameDetails)
ElectroServerApiUsed to do a quick join game for the identified user, with preference given to a game that has a buddy in it.
GameDetails are used to provide extra information to the GameManager for searching and identifying the game.
quickJoinGameWithBuddyForUser in interface ElectroServerApiuserName - user that wants to join a gamegameType - the game type to joinzoneName - the name of the zone in which to create the game room - this zone will be created if neededgameDetails - the custom details of the game that are to be made available to the GameManager (this can be changed later if needed)
public GameManagerResponse quickJoinGameForUser(String userName,
String gameType,
String zoneName,
EsObject gameDetails)
ElectroServerApiUsed to do a quick join game for the identified user. GameDetails are used to provide extra information to the GameManager for searching and identifying the game. If no buddies are playing the specified gameType, a standard QuickJoinGame is done, so user may end up playing with a non-buddy or creating a new game.
quickJoinGameForUser in interface ElectroServerApiuserName - user that wants to join a gamegameType - the game type to joinzoneName - the name of the zone in which to create the game room - this zone will be created if neededgameDetails - the custom details of the game that are to be made available to the GameManager (this can be changed later if needed)
public FindGamesWithBuddiesResponse findAllGamesWithBuddies(String userName,
String gameType,
EsObject gameDetails)
ElectroServerApiFinds games being played by any buddies of the specified user. This is less efficient than findOneGameWithBuddies, but useful if the client wants to be able to choose which game to join.
findAllGamesWithBuddies in interface ElectroServerApiuserName - user that wants to know about gamesgameType - the game type the user is interested ingameDetails - the custom details of the game to be used in the SearchCriteria
public com.electrotank.electroserver5.entities.GameRO findOneGameWithBuddies(String userName,
String gameType,
EsObject gameDetails)
ElectroServerApiFinds one game being played by a buddy of the specified user.
findOneGameWithBuddies in interface ElectroServerApiuserName - user that wants to know about gamesgameType - the game type the user is interested ingameDetails - the custom details of the game to be used in the SearchCriteria
public int getUserCountByZoneId(int zoneId,
boolean distinct)
ElectroServerApi
getUserCountByZoneId in interface ElectroServerApizoneId - - zonedistinct - - if a user is in two rooms in this zone, should he be counted twice?
public int getUserCountByZoneName(String zoneName,
boolean distinct)
ElectroServerApi
getUserCountByZoneName in interface ElectroServerApizoneName - - zonedistinct - - if a user is in two rooms in this zone, should he be counted twice?
public int getUserCountByGameType(String gameType,
boolean distinct)
ElectroServerApi
getUserCountByGameType in interface ElectroServerApigameType - as registered with GameManagerdistinct - - if a user is in two games of this gameType, should he be counted twice?
public void setSuppressBuddyEventsForUser(String userName,
boolean value)
ElectroServerApi
setSuppressBuddyEventsForUser in interface ElectroServerApiuserName - user to toggle events forvalue - true to suppress the buddy events for this user, false to enable thempublic boolean isSuppressBuddyEventsForUser(String userName)
ElectroServerApi
isSuppressBuddyEventsForUser in interface ElectroServerApiuserName - name of the user
public Collection<String> getAllConnectedUsers()
ElectroServerApi
getAllConnectedUsers in interface ElectroServerApipublic long getIdleMillisecondsForUser(String userName)
ElectroServerApi
getIdleMillisecondsForUser in interface ElectroServerApiuserName - of the user
public int getUserIdleDisconnectTimeSeconds()
ElectroServerApi
getUserIdleDisconnectTimeSeconds in interface ElectroServerApipublic Map<String,Integer> getGameCountByType()
ElectroServerApi
getGameCountByType in interface ElectroServerApipublic List<RoomValue> getUserJoinedRooms(String userName)
ElectroServerApi
getUserJoinedRooms in interface ElectroServerApipublic List<com.electrotank.electroserver5.entities.GameRO> getUserJoinedGames(String userName)
ElectroServerApi
getUserJoinedGames in interface ElectroServerApipublic void suspendIdleKickingForUser(String userName)
ElectroServerApi
suspendIdleKickingForUser in interface ElectroServerApipublic void resumeIdleKickingForUser(String userName)
ElectroServerApi
resumeIdleKickingForUser in interface ElectroServerApi
public void setAutoIdleKickingForUser(String userName,
boolean value)
ElectroServerApi
setAutoIdleKickingForUser in interface ElectroServerApivalue - true to automatically resume idle kicking
public PluginApiResponse grantOperatorStatus(String userName,
int zoneId,
int roomId)
ElectroServerApi
grantOperatorStatus in interface ElectroServerApi
public PluginApiResponse revokeOperatorStatus(String userName,
int zoneId,
int roomId)
ElectroServerApi
revokeOperatorStatus in interface ElectroServerApi
public boolean isRoomOperator(String userName,
int zoneId,
int roomId)
ElectroServerApi
isRoomOperator in interface ElectroServerApi
public List<String> getRoomOperators(int zoneId,
int roomId)
ElectroServerApi
getRoomOperators in interface ElectroServerApipublic Collection<ReadOnlyUserServerVariable> getUserServerVariables(String userName)
ElectroServerApiLoginEventHandler.
getUserServerVariables in interface ElectroServerApiuserName - the user name
public RoomResponse liftRoomBanForUser(String userName,
int zoneId,
int roomId)
ElectroServerApi
liftRoomBanForUser in interface ElectroServerApi
public RoomValue getRoom(int zoneId,
int roomId)
ElectroServerApi
getRoom in interface ElectroServerApi
public Collection<RoomValue> getRooms(int zoneId,
String roomName)
ElectroServerApi
getRooms in interface ElectroServerApi
public Collection<RoomValue> getRooms(String zoneName,
int roomId)
ElectroServerApi
getRooms in interface ElectroServerApi
public Collection<RoomValue> getRooms(String zoneName,
String roomName)
ElectroServerApi
getRooms in interface ElectroServerApipublic void disableAllLogins()
ElectroServerApi
disableAllLogins in interface ElectroServerApipublic void enableLogins()
ElectroServerApi
enableLogins in interface ElectroServerApipublic boolean areLoginsEnabled()
ElectroServerApi
areLoginsEnabled in interface ElectroServerApipublic Collection<String> getConnectedUsers()
ElectroServerApi
getConnectedUsers in interface ElectroServerApipublic void kickAllUsers()
ElectroServerApi
kickAllUsers in interface ElectroServerApipublic com.electrotank.electroserver5.enumerations.ErrorType getLogoutType(String userName)
ElectroServerApi
getLogoutType in interface ElectroServerApipublic EsObjectRO getLogoutReason(String userName)
ElectroServerApi
getLogoutReason in interface ElectroServerApipublic String getUserClientType(String userName)
ElectroServerApi
getUserClientType in interface ElectroServerApipublic String getUserClientVersion(String userName)
ElectroServerApi
getUserClientVersion in interface ElectroServerApipublic int getUserIdleWarningTimeMS(String userName)
ElectroServerApi
getUserIdleWarningTimeMS in interface ElectroServerApi
public void setUserIdleWarningTimeMS(String userName,
int durationMS)
ElectroServerApi
setUserIdleWarningTimeMS in interface ElectroServerApipublic void shutdownServer()
ElectroServerApi
shutdownServer in interface ElectroServerApipublic void restartServer()
ElectroServerApi
restartServer in interface ElectroServerApi
public PluginApiResponse sendPublicMessageToRoomFromPlugin(String userName,
int zoneId,
int roomId,
String message,
EsObject esObject,
boolean executePublicMessageEventHandlers,
boolean executePluginUserSendPublicMessage)
ElectroServerApi
sendPublicMessageToRoomFromPlugin in interface ElectroServerApiuserName - - name that the message will appear to be fromzoneId - - zoneId of the roomroomId - - roomId of the roommessage - - message to be deliveredesObject - - optional EsObject for the messageexecutePublicMessageEventHandlers - - if true, any server level
PublicMessageEventHandler will be executed. This is useful
if you have a global chat logger, for example.executePluginUserSendPublicMessage - - if true, any room plugin
attached to the room that implements userSendPluginMessage
will have that method executed. This is useful if you
log the chat in the room using the room plugin.
public PluginPrivateMessageResponse sendPrivateMessageToUserFromPlugin(String fromName,
String toName,
String message,
EsObject esObject,
boolean executePrivateMessageEventHandlers)
ElectroServerApi
sendPrivateMessageToUserFromPlugin in interface ElectroServerApifromName - - name that the message will appear to be fromtoName - - username of the recipientmessage - - message to be sentesObject - - optional EsObjectexecutePrivateMessageEventHandlers - - if true, any server level
PrivateMessageEventHandler will be executed. This is useful
if you have a chat logger for private chat, for example.
public PluginPrivateMessageResponse sendPrivateMessageToUsersFromPlugin(String fromName,
String[] toNames,
String message,
EsObject esObject,
boolean executePrivateMessageEventHandlers)
ElectroServerApi
sendPrivateMessageToUsersFromPlugin in interface ElectroServerApifromName - - name that the message will appear to be fromtoNames - - array of usernames (the recipients)message - - message to be sentesObject - - optional EsObjectexecutePrivateMessageEventHandlers - - if true, any server level
PrivateMessageEventHandler will be executed. This is useful
if you have a chat logger for private chat, for example.
public void sendCreateOrJoinGameResponse(String userName,
GameManagerResponse response)
ElectroServerApi
sendCreateOrJoinGameResponse in interface ElectroServerApi
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||