com.electrotank.electroserver5.extensions.api
Class ElectroServerApiImpl

java.lang.Object
  extended by com.electrotank.electroserver5.extensions.api.ElectroServerApiImpl
All Implemented Interfaces:
ElectroServerApi
Direct Known Subclasses:
EventApiImpl, ManagedObjectFactoryApiImpl, PluginApiImpl

public abstract class ElectroServerApiImpl
extends Object
implements ElectroServerApi

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

extensionManager

protected final com.electrotank.electroserver5.entities.managers.ExtensionManager extensionManager
Constructor Detail

ElectroServerApiImpl

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)
Parameters:
bridge -
gateways -
roomManager -
people -
scheduledExecutorService -
languageFilterManager -
fileSystem -
gameManager -
buddyListManager -
eventManager -
Method Detail

addBuddy

public boolean addBuddy(String userName,
                        String buddyName,
                        EsObjectRO esObject)
Description copied from interface: ElectroServerApi
Adds a buddy to the specified user's buddy list. This method only works if the user (not the buddy) is currently online. The boolean returned will indicate success or failure. The associated EsObject is provided as a convenience that allows the developer to associate meta-data with the relationship. A good example of this might be group information.

Specified by:
addBuddy in interface ElectroServerApi
Parameters:
userName - user name of the user whose buddy list the buddy should be added
buddyName - user name of the buddy to be added
esObject - optional meta-data to be associated with the buddy
Returns:
true if the addition was successful, false otherwise
See Also:
removeBuddy

removeBuddy

public boolean removeBuddy(String userName,
                           String buddyName)
Description copied from interface: ElectroServerApi
Removes a buddy from the specified user's buddy list. This method only works if the user (not the buddy) is currently online. The boolean returned will indicate success or failure.

Specified by:
removeBuddy in interface ElectroServerApi
Parameters:
userName - user name of the user whose buddy list the buddy should be removed
buddyName - user name of the buddy to be removed
Returns:
true if the removal was successful, false otherwise
See Also:
addBuddy, EsObject

applyLanguageFilterToString

public LanguageFilterResponse applyLanguageFilterToString(String languageFilterName,
                                                          String stringToTest)
Description copied from interface: ElectroServerApi
Used to call one of the configured language filters to determine if a given string is valid or not. The filter used will behave exactly as it does normally except it doesn't take any action against the user if a string fails. The response object contains all the details on the sucess of the call. Of particular interest is the success or failure boolean, which is used to determine if the call was successful. If the call failed, check the error status with the getError method on the response object. Finally, if the call was sucessful, the isStringValid method is used to determine if the string passed or failed the test.

Specified by:
applyLanguageFilterToString in interface ElectroServerApi
Parameters:
languageFilterName - the name of the language filter to invoke
stringToTest - the string to test with the selected langauge filter
Returns:
a response object containing all the details of the call
See Also:
LanguageFilterResponse

getLogger

public org.slf4j.Logger getLogger()
Description copied from interface: ElectroServerApi

Acquires 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.

Specified by:
getLogger in interface ElectroServerApi
Returns:
SLF4J Logger interface for the current component

sendPluginMessageToUser

public PluginPrivateMessageResponse sendPluginMessageToUser(String userName,
                                                            EsObjectRO variables)
Description copied from interface: ElectroServerApi
Sends a plugin message to a user. With the associated EsObject, almost anything can be sent.

Specified by:
sendPluginMessageToUser in interface ElectroServerApi
Parameters:
userName - the name of the user
variables - the EsObject to send as part of the message
Returns:
a response indicating the status of the delivery
See Also:
sendPluginMessageToRoom, sendPluginMessageToRooms, sendPluginMessageToServer, sendPluginMessageToUsers, sendPluginMessageToZone, sendPluginMessageToZones, PluginPublicMessageResponse, EsObjectRO

sendPluginMessageToUser

public PluginPrivateMessageResponse sendPluginMessageToUser(String userName,
                                                            com.electrotank.electroserver5.messages.Message.Reliability reliability,
                                                            EsObjectRO variables)
Description copied from interface: ElectroServerApi
Sends a plugin message to a user. With the associated EsObject, almost anything can be sent.

Specified by:
sendPluginMessageToUser in interface ElectroServerApi
Parameters:
userName - the name of the user
variables - the EsObject to send as part of the message
Returns:
a response indicating the status of the delivery
See Also:
sendPluginMessageToRoom, sendPluginMessageToRooms, sendPluginMessageToServer, sendPluginMessageToUsers, sendPluginMessageToZone, sendPluginMessageToZones, PluginPublicMessageResponse, EsObjectRO

sendPluginMessageToUsers

public PluginPrivateMessageResponse sendPluginMessageToUsers(String[] userNames,
                                                             EsObjectRO variables)
Description copied from interface: ElectroServerApi
Sends a plugin message to a group of users. With the associated EsObject, almost anything can be sent.

Specified by:
sendPluginMessageToUsers in interface ElectroServerApi
Parameters:
userNames - an array of user names that should receive this mesage
variables - the EsObject to send as part of the message
Returns:
a response indicating the status of the delivery
See Also:
sendPluginMessageToRoom, sendPluginMessageToRooms, sendPluginMessageToServer, sendPluginMessageToUser, sendPluginMessageToZone, sendPluginMessageToZones, PluginPublicMessageResponse, EsObjectRO

sendPluginMessageToUsers

public PluginPrivateMessageResponse sendPluginMessageToUsers(Collection<String> userNames,
                                                             EsObjectRO variables)
Description copied from interface: ElectroServerApi
Sends a plugin message to a group of users. With the associated EsObject, almost anything can be sent.

Specified by:
sendPluginMessageToUsers in interface ElectroServerApi
Parameters:
userNames - a Collection of user names that should receive this mesage
variables - the EsObject to send as part of the message
Returns:
a response indicating the status of the delivery
See Also:
sendPluginMessageToRoom, sendPluginMessageToRooms, sendPluginMessageToServer, sendPluginMessageToUser, sendPluginMessageToZone, sendPluginMessageToZones, PluginPublicMessageResponse, EsObjectRO

sendPluginMessageToServer

public PluginPublicMessageResponse sendPluginMessageToServer(EsObjectRO variables)
Description copied from interface: ElectroServerApi
Sends a plugin message to the entire server. With the associated EsObject, almost anything can be sent. Note: this only sends to users who are in rooms. Kept for backward compatibility with ES4.

Specified by:
sendPluginMessageToServer in interface ElectroServerApi
Parameters:
variables - the EsObject to send as part of the message
Returns:
a response indicating the status of the delivery
See Also:
sendPluginMessageToRoom, sendPluginMessageToRooms, sendPluginMessageToUser, sendPluginMessageToUsers, sendPluginMessageToZone, sendPluginMessageToZones, sendGlobalPrivateMessage, sendGlobalPluginMessage, PluginPublicMessageResponse, EsObjectRO

sendPluginMessageToZone

public PluginPublicMessageResponse sendPluginMessageToZone(int zoneId,
                                                           EsObjectRO variables)
Description copied from interface: ElectroServerApi
Sends a plugin message to all users in a zone. With the associated EsObject, almost anything can be sent.

Specified by:
sendPluginMessageToZone in interface ElectroServerApi
Parameters:
zoneId - the zone ID
variables - the EsObject to send as part of the message
Returns:
a response indicating the status of the delivery
See Also:
sendPluginMessageToRoom, sendPluginMessageToRooms, sendPluginMessageToServer, sendPluginMessageToUser, sendPluginMessageToUsers, sendPluginMessageToZones, PluginPublicMessageResponse, EsObjectRO

sendPluginMessageToZones

public PluginPublicMessageResponse sendPluginMessageToZones(int[] zoneIds,
                                                            EsObjectRO variables)
Description copied from interface: ElectroServerApi
Sends a plugin message to a group of zones. With the associated EsObject, almost anything can be sent.

Specified by:
sendPluginMessageToZones in interface ElectroServerApi
Parameters:
zoneIds - an array of zone IDs
variables - the EsObject to send as part of the message
Returns:
a response indicating the status of the delivery
See Also:
sendPluginMessageToRoom, sendPluginMessageToRooms, sendPluginMessageToServer, sendPluginMessageToUser, sendPluginMessageToUsers, sendPluginMessageToZone, PluginPublicMessageResponse, EsObjectRO

sendPluginMessageToZones

public PluginPublicMessageResponse sendPluginMessageToZones(Collection<Integer> zoneIds,
                                                            EsObjectRO variables)
Description copied from interface: ElectroServerApi
Sends a plugin message to a group of zones. With the associated EsObject, almost anything can be sent.

Specified by:
sendPluginMessageToZones in interface ElectroServerApi
Parameters:
zoneIds - a Collection of zone IDs
variables - the EsObject to send as part of the message
Returns:
a response indicating the status of the delivery
See Also:
sendPluginMessageToRoom, sendPluginMessageToRooms, sendPluginMessageToServer, sendPluginMessageToUser, sendPluginMessageToUsers, sendPluginMessageToZone, PluginPublicMessageResponse, EsObjectRO

sendPluginMessageToRoom

public PluginPublicMessageResponse sendPluginMessageToRoom(int zoneId,
                                                           int roomId,
                                                           com.electrotank.electroserver5.messages.Message.Reliability reliability,
                                                           EsObjectRO variables)
Specified by:
sendPluginMessageToRoom in interface ElectroServerApi

sendPluginMessageToRoom

public PluginPublicMessageResponse sendPluginMessageToRoom(int zoneId,
                                                           int roomId,
                                                           EsObjectRO variables)
Description copied from interface: ElectroServerApi
Sends a plugin message to all users in a room. With the associated EsObject, almost anything can be sent.

Specified by:
sendPluginMessageToRoom in interface ElectroServerApi
Parameters:
zoneId - the zone ID
roomId - the room ID
variables - the EsObject to send as part of the message
Returns:
a response indicating the status of the delivery
See Also:
sendPluginMessageToRooms, sendPluginMessageToServer, sendPluginMessageToUser, sendPluginMessageToUsers, sendPluginMessageToZone, sendPluginMessageToZones, PluginPublicMessageResponse, EsObjectRO

sendPluginMessageToRooms

public PluginPublicMessageResponse sendPluginMessageToRooms(Map<Integer,Collection<Integer>> zoneRoomCombos,
                                                            EsObjectRO variables)
Description copied from interface: ElectroServerApi
Sends a plugin message to a group of rooms. With the associated EsObject, almost anything can be sent.

Specified by:
sendPluginMessageToRooms in interface ElectroServerApi
Parameters:
zoneRoomCombos - a map containing the zone ID as a key tied to a list of room IDs
variables - the EsObject to send as part of the message
Returns:
a response indicating the status of the delivery
See Also:
sendPluginMessageToRoom, sendPluginMessageToServer, sendPluginMessageToUser, sendPluginMessageToUsers, sendPluginMessageToZone, sendPluginMessageToZones, PluginPublicMessageResponse, EsObjectRO

createRoomInNamedZone

public RoomResponse createRoomInNamedZone(String zoneName,
                                          boolean joinExistingZone,
                                          RoomConfiguration roomConfig,
                                          UserConfig[] userConfigs)
Description copied from interface: ElectroServerApi
Creates a room in the specified zone using the supplied room configuration. Once the room is created, the users are joined via the user configuration array. The RoomResponse returned from this call provides details on the status of the call.

Specified by:
createRoomInNamedZone in interface ElectroServerApi
Parameters:
zoneName - the zone name
joinExistingZone - boolean indicating if the room should join an existing zone if it exists
roomConfig - the room configuration to use for this new room
userConfigs - the configuration of users to join this room
Returns:
a response indicating the status of the call
See Also:
createRoom, destroyRoom, RoomResponse, RoomConfiguration, UserConfig

createRoomInNamedZone

public RoomResponse createRoomInNamedZone(String zoneName,
                                          boolean joinExistingZone,
                                          RoomConfiguration roomConfig,
                                          Collection<UserConfig> userConfigs)
Description copied from interface: ElectroServerApi
Creates a room in the specified zone using the supplied room configuration. Once the room is created, the users are joined via the user configuration collection. The RoomResponse returned from this call provides details on the status of the call.

Specified by:
createRoomInNamedZone in interface ElectroServerApi
Parameters:
zoneName - the zone name
joinExistingZone - boolean indicating if the room should join an existing zone if it exists
roomConfig - the room configuration to use for this new room
userConfigs - the configuration of users to join this room
Returns:
a response indicating the status of the call
See Also:
createRoom, destroyRoom, RoomResponse, RoomConfiguration, UserConfig

createRoom

public RoomResponse createRoom(int zoneId,
                               RoomConfiguration roomConfig,
                               UserConfig[] userConfigs)
Description copied from interface: ElectroServerApi
Creates a room in the specified zone using the supplied room configuration. Once the room is created, the users are joined via the user configuration array. The RoomResponse returned from this call provides details on the status of the call.

Specified by:
createRoom in interface ElectroServerApi
Parameters:
zoneId - the zone id
roomConfig - the room configuration to use for this new room
userConfigs - the configuration of users to join this room
Returns:
a response indicating the status of the call
See Also:
createRoomInNamedZone, destroyRoom, RoomResponse, RoomConfiguration, UserConfig

createRoom

public RoomResponse createRoom(int zoneId,
                               RoomConfiguration roomConfig,
                               Collection<UserConfig> userConfigs)
Description copied from interface: ElectroServerApi
Creates a room in the specified zone using the supplied room configuration. Once the room is created, the users are joined via the user configuration collection. The RoomResponse returned from this call provides details on the status of the call.

Specified by:
createRoom in interface ElectroServerApi
Parameters:
zoneId - the zone id
roomConfig - the room configuration to use for this new room
userConfigs - the configuration of users to join this room
Returns:
a response indicating the status of the call
See Also:
createRoomInNamedZone, destroyRoom, RoomResponse, RoomConfiguration, UserConfig

destroyRoom

public void destroyRoom(int zoneId,
                        int roomId)
Description copied from interface: ElectroServerApi
Destroys the room specified by the room and zone IDs. Any users in the room will be notified that the room is destroyed.

Specified by:
destroyRoom in interface ElectroServerApi
Parameters:
zoneId - the zone ID
roomId - the room ID
See Also:
createRoom, createRoomInNamedZone

addUsersToRoom

public RoomResponse addUsersToRoom(int zoneId,
                                   int roomId,
                                   String password,
                                   UserConfig[] userConfigs)
Description copied from interface: ElectroServerApi
Adds the users defined in the UserConfig array to the specified room. From the user's standpoint, this method behaves the same as if the user joined the room directly. The RoomResponse returned from this call provides details on the status of the call.

Specified by:
addUsersToRoom in interface ElectroServerApi
Parameters:
zoneId - zone ID for the specific room
roomId - room ID for the specific room
password - password of the room
userConfigs - configuration array of the users to join the specified room
Returns:
response indicating the status of the call with details for each user
See Also:
RoomResponse, UserConfig

addUsersToRoom

public RoomResponse addUsersToRoom(int zoneId,
                                   int roomId,
                                   String password,
                                   Collection<UserConfig> userConfigs)
Description copied from interface: ElectroServerApi
Adds the users defined in the UserConfig collection to the specified room. From the user's standpoint, this method behaves the same as if the user joined the room directly. The RoomResponse returned from this call provides details on the status of the call.

Specified by:
addUsersToRoom in interface ElectroServerApi
Parameters:
zoneId - zone ID for the specific room
roomId - room ID for the specific room
password - password of the room
userConfigs - configuration collection of the users to join the specified room
Returns:
response indicating the status of the call with details for each user
See Also:
RoomResponse, UserConfig

createRoomVariable

public RoomVariableResponse createRoomVariable(int zoneId,
                                               int roomId,
                                               String name,
                                               EsObject value,
                                               boolean locked)
Description copied from interface: ElectroServerApi
Creates a room variable in the specified room.

Specified by:
createRoomVariable in interface ElectroServerApi
Parameters:
zoneId - the zone ID
roomId - the room ID
name - the name of the variable
value - the value of the variable
locked - a boolean indicating if the variable is locked or not
Returns:
a response indicating the status of the call
See Also:
createRoomVariableForUser, updateRoomVariable, deleteRoomVariable, RoomVariableResponse, EsObject

createRoomVariableForUser

public RoomVariableResponse createRoomVariableForUser(int zoneId,
                                                      int roomId,
                                                      String name,
                                                      EsObject value,
                                                      boolean locked,
                                                      String username,
                                                      boolean persistent)
Description copied from interface: ElectroServerApi
Creates a room variable in the specified room, tied to a given user.

Specified by:
createRoomVariableForUser in interface ElectroServerApi
Parameters:
zoneId - the zone ID
roomId - the room ID
name - the name of the variable
value - the value of the variable
locked - a boolean indicating if the variable is locked or not
username - name of the user tied to the variable
persistent - is this a persistent variable
Returns:
a response indicating the status of the call
See Also:
createRoomVariable, updateRoomVariable, deleteRoomVariable, RoomVariableResponse, EsObject

updateRoomVariable

public RoomVariableResponse updateRoomVariable(int zoneId,
                                               int roomId,
                                               String name,
                                               boolean valueUpdated,
                                               EsObject value,
                                               boolean lockStatusUpdated,
                                               boolean locked)
Description copied from interface: ElectroServerApi
Updates the specified room variable.

Specified by:
updateRoomVariable in interface ElectroServerApi
Parameters:
zoneId - the zone ID
roomId - the room ID
name - the name of the variable
valueUpdated - a boolean indicating if the variable was updated
value - the value of the variable
lockStatusUpdated - a boolean indicating if the lock has been changed
locked - the value of the lock
Returns:
a response indicating the status of the call
See Also:
createRoomVariable, createRoomVariableForUser, deleteRoomVariable, RoomVariableResponse, EsObject

deleteRoomVariable

public RoomVariableResponse deleteRoomVariable(int zoneId,
                                               int roomId,
                                               String name)
Description copied from interface: ElectroServerApi
Deletes the specified room variable.

Specified by:
deleteRoomVariable in interface ElectroServerApi
Parameters:
zoneId - the zone ID
roomId - the room ID
name - the name of the variable
Returns:
a response indicating the status of the call
See Also:
createRoomVariable, createRoomVariableForUser, updateRoomVariable, RoomVariableResponse

getRoomVariables

public Collection<ReadOnlyRoomVariable> getRoomVariables(int zoneId,
                                                         int roomId)
Description copied from interface: ElectroServerApi
Looks up and returns all room variables in a given room.

Specified by:
getRoomVariables in interface ElectroServerApi
Parameters:
zoneId - the zone ID
roomId - the room ID
Returns:
a collection of all room variables in the room
See Also:
getRoomVariable, ReadOnlyRoomVariable

getRoomVariable

public ReadOnlyRoomVariable getRoomVariable(int zoneId,
                                            int roomId,
                                            String name)
Description copied from interface: ElectroServerApi
Looks up and returns a specific room variable.

Specified by:
getRoomVariable in interface ElectroServerApi
Parameters:
zoneId - the zone ID
roomId - the room ID
name - the variable name
Returns:
a read-only room variable
See Also:
getRoomVariables, ReadOnlyRoomVariable

createOrUpdateUserVariable

public UserVariableResponse createOrUpdateUserVariable(String userName,
                                                       String name,
                                                       EsObject value)
Description copied from interface: ElectroServerApi
Creates or updates a user variable as needed. The user must be logged in, so this will not work inside a LoginEventHandler.

Specified by:
createOrUpdateUserVariable in interface ElectroServerApi
Parameters:
userName - the user name
name - the variable name
value - the variable value
Returns:
a response indicating the status of the call
See Also:
deleteUserVariable, getUserVariable, getUserVariables, UserVariableResponse, EsObject

deleteUserVariable

public UserVariableResponse deleteUserVariable(String userName,
                                               String name)
Description copied from interface: ElectroServerApi
Deletes the specified user variable. The user must be logged in, so this will not work inside a LoginEventHandler.

Specified by:
deleteUserVariable in interface ElectroServerApi
Parameters:
userName - the user name
name - the variable name
Returns:
a response indicating the status of the call
See Also:
createOrUpdateUserVariable, getUserVariable, getUserVariables, UserVariableResponse

getUserVariables

public Collection<ReadOnlyUserVariable> getUserVariables(String userName)
Description copied from interface: ElectroServerApi
Looks up and returns all the user variables for a given user. The user must be logged in, so this will not work inside a LoginEventHandler.

Specified by:
getUserVariables in interface ElectroServerApi
Parameters:
userName - the user name
Returns:
a collection of read-only user variables
See Also:
getUserVariable, ReadOnlyUserVariable

getUserVariable

public ReadOnlyUserVariable getUserVariable(String userName,
                                            String name)
Description copied from interface: ElectroServerApi
Looks up and returns a specific user variable. This method will return null if the user variable isn't found. The user must be logged in, so this will not work inside a LoginEventHandler.

Specified by:
getUserVariable in interface ElectroServerApi
Parameters:
userName - the user name
name - the variable name
Returns:
a read-only user variable or null if it wasn't found
See Also:
getUserVariables, ReadOnlyUserVariable

getZones

public Collection<ZoneValue> getZones()
Description copied from interface: ElectroServerApi
Looks up and returns all the zones on the server.

Specified by:
getZones in interface ElectroServerApi
Returns:
a collection of read-only zones
See Also:
ZoneValue

getRoomsInZone

public Collection<RoomValue> getRoomsInZone(int zoneId)
Description copied from interface: ElectroServerApi
Looks up and returns all the rooms in a given zone.

Specified by:
getRoomsInZone in interface ElectroServerApi
Parameters:
zoneId - the zone ID
Returns:
a collection of read-only rooms
See Also:
getRoomsInZoneByName, RoomValue

getRoomsInZoneByName

public Collection<RoomValue> getRoomsInZoneByName(String zoneName)
Description copied from interface: ElectroServerApi
Looks up and returns all the rooms in a given zone.

Specified by:
getRoomsInZoneByName in interface ElectroServerApi
Parameters:
zoneName - the zone name
Returns:
a collection of read-only rooms
See Also:
getRoomsInZone, RoomValue

getUsersInRoom

public Collection<UserValue> getUsersInRoom(int zoneId,
                                            int roomId)
Description copied from interface: ElectroServerApi
Looks up and returns all the users in a given room.

Specified by:
getUsersInRoom in interface ElectroServerApi
Parameters:
zoneId - the zone ID
roomId - the room ID
Returns:
a collection of read-only user
See Also:
getUser, UserValue

getUser

public UserValue getUser(String userName)
Description copied from interface: ElectroServerApi
Used to return details on the specified user. This method retuns null if a user with the specified name is not found.

Specified by:
getUser in interface ElectroServerApi
Parameters:
userName - the name of the user
Returns:
a UserValue containing data on the user or null of the user was not found
See Also:
getUsersInRoom, UserValue

getIpForUser

public List<InetAddress> getIpForUser(String userName)
Description copied from interface: ElectroServerApi
Gets a list of IP addresses the user is connecting from or null if the user is not known.

Specified by:
getIpForUser in interface ElectroServerApi
Parameters:
userName - the user's name
Returns:
a list of IP addresses or null

getUserServerVariable

public UserServerVariableResponse getUserServerVariable(String userName,
                                                        String variableName)
Description copied from interface: ElectroServerApi
Looks up and returns a user server variable. The user must be logged in, so this will not work inside a LoginEventHandler.

Specified by:
getUserServerVariable in interface ElectroServerApi
Parameters:
userName - the user name
variableName - the variable name
Returns:
a response indicating the status of the call and, if successful, a read-only user server variable
See Also:
setUserServerVariable, deleteUserServerVariable, UserServerVariableResponse

setUserServerVariable

public UserServerVariableResponse setUserServerVariable(String userName,
                                                        String variableName,
                                                        EsObject variableValue)
Description copied from interface: ElectroServerApi
Sets a user server variable on a given user. The user must be logged in, so this will not work inside a LoginEventHandler.

Specified by:
setUserServerVariable in interface ElectroServerApi
Parameters:
userName - the user name
variableName - the variable name
variableValue - the variable value
Returns:
a response indicating the status of the call
See Also:
getUserServerVariable, deleteUserServerVariable, UserServerVariableResponse, EsObject

deleteUserServerVariable

public UserServerVariableResponse deleteUserServerVariable(String userName,
                                                           String variableName)
Description copied from interface: ElectroServerApi
Deletes a given user server variable from the specified user. The user must be logged in, so this will not work inside a LoginEventHandler.

Specified by:
deleteUserServerVariable in interface ElectroServerApi
Parameters:
userName - the user name
variableName - the variable name
Returns:
a response indicating the status of the call
See Also:
getUserServerVariable, setUserServerVariable, UserServerVariableResponse

getExtensionBoundUserServerVariable

public ExtensionBoundUserServerVariableResponse getExtensionBoundUserServerVariable(String userName,
                                                                                    String variableName)
Description copied from interface: ElectroServerApi
Looks up and returns an extension-bound user server variable. The user must be logged in, so this will not work inside a LoginEventHandler.

Specified by:
getExtensionBoundUserServerVariable in interface ElectroServerApi
Parameters:
userName - the user name
variableName - the variable name
Returns:
a response indicating the status of the call and, if successful, a read-only extension-bound user server variable
See Also:
setExtensionBoundUserServerVariable, deleteExtensionBoundUserServerVariable, ExtensionBoundUserServerVariableResponse

setExtensionBoundUserServerVariable

public ExtensionBoundUserServerVariableResponse setExtensionBoundUserServerVariable(String userName,
                                                                                    String variableName,
                                                                                    Object variableValue)
Description copied from interface: ElectroServerApi
Sets an extension-bound user server variable on a given user. The user must be logged in, so this will not work inside a LoginEventHandler.

Specified by:
setExtensionBoundUserServerVariable in interface ElectroServerApi
Parameters:
userName - the user name
variableName - the variable name
variableValue - the variable value
Returns:
a response indicating the status of the call
See Also:
getExtensionBoundUserServerVariable, deleteExtensionBoundUserServerVariable, ExtensionBoundUserServerVariableResponse

deleteExtensionBoundUserServerVariable

public ExtensionBoundUserServerVariableResponse deleteExtensionBoundUserServerVariable(String userName,
                                                                                       String variableName)
Description copied from interface: ElectroServerApi
Deletes an extension-bound user server variable. The user must be logged in, so this will not work inside a LoginEventHandler.

Specified by:
deleteExtensionBoundUserServerVariable in interface ElectroServerApi
Parameters:
userName - the user name
variableName - the variable name
Returns:
a response indicating the status of the call
See Also:
getExtensionBoundUserServerVariable, setExtensionBoundUserServerVariable, ExtensionBoundUserServerVariableResponse

getUserIdFromName

protected long getUserIdFromName(String userName)

getUserIdsFromNameList

protected Collection<Long> getUserIdsFromNameList(Collection<String> userNames)

getUsersFromNameList

protected Collection<com.electrotank.electroserver5.entities.ConnectedUser> getUsersFromNameList(Collection<String> userNames)

isUserLoggedIn

public boolean isUserLoggedIn(String userName)
Description copied from interface: ElectroServerApi
Determines if a user is currently logged in or not.

Specified by:
isUserLoggedIn in interface ElectroServerApi
Parameters:
userName - the users name
Returns:
a boolean indicating if the user is logged in

getExtensionBoundServerVariable

public Object getExtensionBoundServerVariable(Object key)
Description copied from interface: ElectroServerApi
Get the ExtensionBoundServerVariable of this name. Must have been created by a component in this extension, usually an ExtensionLifecycleEventHandler. Cast it to the correct class after it is returned.

Specified by:
getExtensionBoundServerVariable in interface ElectroServerApi
Parameters:
key - - name of the variable
Returns:
Object - the variable

putExtensionBoundServerVariable

public void putExtensionBoundServerVariable(Object key,
                                            Object variable)
Description copied from interface: ElectroServerApi
Add or update the ExtensionBoundServerVariable of this name.

Specified by:
putExtensionBoundServerVariable in interface ElectroServerApi
Parameters:
key - - name of the variable
variable - - variable to be stored

acquireManagedObject

public Object acquireManagedObject(String factoryName,
                                   EsObjectRO parameters)
Description copied from interface: ElectroServerApi

Acquires 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.

Specified by:
acquireManagedObject in interface ElectroServerApi
Parameters:
factoryName - name of the managed object factory as it is defined in the specific extension.xml file.
parameters - optional EsObject that will be passed
Returns:
object returned from the factory
See Also:
releaseManagedObject, ManagedObjectFactory, EsObject, ElectroServer 4 Manual

releaseManagedObject

public void releaseManagedObject(String factoryName,
                                 Object object)
Description copied from interface: ElectroServerApi
Releases a managed object back to the specified 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.

Specified by:
releaseManagedObject in interface ElectroServerApi
Parameters:
factoryName - the factory's name
object - the object to release
See Also:
acquireManagedObject, ManagedObjectFactory, EsObject, ElectroServer 4 Manual

getRoomPlugin

public Plugin getRoomPlugin(int zoneId,
                            int roomId,
                            String pluginName)
Description copied from interface: 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.

Specified by:
getRoomPlugin in interface ElectroServerApi
Parameters:
zoneId - the zone ID
roomId - the room ID
pluginName - the name of the plugin
Returns:
the designated Plugin
See Also:
getServerPlugin, Plugin

kickUserFromRoom

public void kickUserFromRoom(String userName,
                             int zoneId,
                             int roomId,
                             String reason)
Description copied from interface: ElectroServerApi
Used to kick a user from a room with a specified message. When invoked, the user specified will recieve the message as part of the kick message from the server. Any users in the room will also be notified that the user was kicked along with the message. NOTE: Two different threads attempting to kick users from the same room could result in deadlock. Use this carefully.

Specified by:
kickUserFromRoom in interface ElectroServerApi
Parameters:
userName - the name of the user to kick
zoneId - the zone ID
roomId - the ID of the room containing the user
reason - the reason the user was kicked
See Also:
banUserFromRoom, kickUserFromServer

banUserFromRoom

public void banUserFromRoom(String userName,
                            int zoneId,
                            int roomId,
                            int duration,
                            String reason)
Description copied from interface: ElectroServerApi

Used 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.

Specified by:
banUserFromRoom in interface ElectroServerApi
Parameters:
userName - the name of the user to kick
zoneId - the zone ID
roomId - the ID of the room containing the user
duration - (seconds) how long the user should be banned or -1 for an indefinite ban
reason - the reason the user was kicked
See Also:
kickUserFromRoom, kickUserFromServer

kickUserFromServer

public void kickUserFromServer(String userName,
                               EsObjectRO reason)
Description copied from interface: ElectroServerApi
Used to kick a user from the server directly. If the user is connected to multiple gateways, they will be disconnected sequentially from each.

Specified by:
kickUserFromServer in interface ElectroServerApi
Parameters:
userName - the name of the user to kick
reason - the reason the user was kicked
See Also:
kickUserFromRoom, banUserFromRoom

evictUserFromServer

public void evictUserFromServer(String userName,
                                EsObjectRO reason)
Description copied from interface: ElectroServerApi
Synchronously evict a user from the system. If they are connected, they will be kicked. If they are zombie'd, their existence will be erased.

Specified by:
evictUserFromServer in interface ElectroServerApi
Parameters:
userName - the name of the user to evict
reason - the reason the user was evicted
See Also:
ElectroServerApi.kickUserFromServer(String, EsObjectRO)

getServerPlugin

public Plugin getServerPlugin(String pluginName)
Description copied from interface: ElectroServerApi

Used 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.

Specified by:
getServerPlugin in interface ElectroServerApi
Parameters:
pluginName - the name of the server-level plugin
Returns:
the designated Plugin
See Also:
getRoomPlugin, Plugin

callServerPlugin

public EsObject callServerPlugin(String pluginName,
                                 EsObjectRO parameters)
Description copied from interface: ElectroServerApi

Used 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.

Specified by:
callServerPlugin in interface ElectroServerApi
Parameters:
pluginName - the plugin name
parameters - the parameters to pass to the "interop" method of the plugin
Returns:
the results of the "interop" method on the designated plugin
See Also:
callRoomPlugin, getRoomPlugin, getServerPlugin, BasePlugin, PluginInterop, EsObject

callRoomPlugin

public EsObject callRoomPlugin(int zoneId,
                               int roomId,
                               String pluginName,
                               EsObjectRO parameters)
Description copied from interface: ElectroServerApi

Used 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.

Specified by:
callRoomPlugin in interface ElectroServerApi
Parameters:
zoneId - the zone ID
roomId - the room ID
pluginName - the name of the plugin
parameters - the parameters to pass to the "interop" method of the plugin
Returns:
the results of the "interop" method on the designated plugin
See Also:
callServerPlugin, getRoomPlugin, getServerPlugin, BasePlugin, PluginInterop, EsObject

callUrl

public void callUrl(String url,
                    boolean isPOST,
                    Map<String,String> parameters,
                    HttpCallback callback)
Description copied from interface: ElectroServerApi
Calls a URL asynchronously and invokes the callback once the call completes. This method is capable of simulating either a GET or POST request directly based on the value of the isPOST boolean. The result of this call is an instance of the HttpResults 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).

Specified by:
callUrl in interface ElectroServerApi
Parameters:
url - address of the page to call
isPOST - true if sending a POST request, false if sending a GET request
parameters - map of name/value parameters to the be sent to the address. Ignored for GET requests
callback - callback to be invoked once this method completes either successfully or not
See Also:
blockAndCallUrl, callUrlFromScript, HttpResults, HttpCallback

callUrlFromScript

public void callUrlFromScript(String url,
                              boolean isPOST,
                              Map<String,String> parameters,
                              String callbackName)
Description copied from interface: ElectroServerApi
Calls a URL asynchronously and invokes the method defined by the callback name once the call completes. This method is capable of simulating either a GET or POST request directly based on the value of the isPOST boolean. The result of this call is an instance of the HttpResults 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!

Specified by:
callUrlFromScript in interface ElectroServerApi
Parameters:
url - address of the page to call
isPOST - true if sending a POST request, false if sending a GET request
parameters - map of name/value parameters to the be sent to the address. Ignored for GET requests
callbackName - callback to be invoked once this method completes either successfully or not
See Also:
blockAndCallUrl, callUrl, HttpResults, HttpCallback

blockAndCallUrl

public HttpResults blockAndCallUrl(String url,
                                   boolean isPOST,
                                   Map<String,String> parameters)
Description copied from interface: ElectroServerApi
Calls a URL and blocks the current thread of execution until a response is recieved or a global timeout is reached. This is a synchronous call. This method is capable of simulating either a GET or POST request directly based on the value of the isPOST boolean. The result of this call is an instance of the HttpResults 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).

Specified by:
blockAndCallUrl in interface ElectroServerApi
Parameters:
url - address of the page to call
isPOST - true if sending a POST request, false if sending a GET request
parameters - map of name/value parameters to the be sent to the address. Ignored for GET requests
Returns:
object indicating sucess or failure of the call as well as any returned data
See Also:
callUrl, callUrlFromScript, HttpResults, HttpCallback

scheduleExecution

public int scheduleExecution(int interval,
                             int numberOfTimes,
                             ScheduledCallback callback)
Description copied from interface: ElectroServerApi

Schedules 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 ...
                        }
                    });

 

Specified by:
scheduleExecution in interface ElectroServerApi
Parameters:
interval - duration (ms) until the execution is called as well as the duration between subsequent executions
numberOfTimes - number of times to execute the callback, -1 is used to indicate indefinite execution
callback - callback to invoke on the schedule
Returns:
ID that represents this scheduled execution
See Also:
scheduleExecutionFromScript, cancelScheduledExecution

scheduleExecutionFromScript

public int scheduleExecutionFromScript(int interval,
                                       int numberOfTimes,
                                       String callbackName)
Description copied from interface: ElectroServerApi

Schedules 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!

Specified by:
scheduleExecutionFromScript in interface ElectroServerApi
Parameters:
interval - duration (ms) until the execution is called as well as the duration between subsequent executions
numberOfTimes - number of times to execute the callback. -1 is used to indicate indefinite execution
callbackName - name of the callback method to invoke on the schedule
Returns:
ID that represents this scheduled execution
See Also:
scheduleExecution, cancelScheduledExecution

cancelScheduledExecution

public void cancelScheduledExecution(int id)
Description copied from interface: ElectroServerApi
Cancels the scheduled execution identified by the ID. This method stops any future callback execution but does not or fail the callback if it's currently running.

Specified by:
cancelScheduledExecution in interface ElectroServerApi
Parameters:
id - ID of the scheduled execution to cancel
See Also:
scheduleExecution, scheduleExecutionFromScript

getName

public String getName()
Description copied from interface: ElectroServerApi
Used to the get the name of this extension component.

Specified by:
getName in interface ElectroServerApi
Returns:
the name of this component

getHandle

public String getHandle()
Description copied from interface: ElectroServerApi
Used to get the handle of this extension component.

Specified by:
getHandle in interface ElectroServerApi
Returns:
the handle of this component

getExtensionName

public String getExtensionName()
Description copied from interface: ElectroServerApi
Used to get the name of the extension that contains this component.

Specified by:
getExtensionName in interface ElectroServerApi
Returns:
the name of the extension

registerGameConfiguration

public void registerGameConfiguration(String gameType,
                                      GameConfiguration configuration)
Description copied from interface: ElectroServerApi

Used 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.

Specified by:
registerGameConfiguration in interface ElectroServerApi
Parameters:
gameType - the game type to associate with this configuration
configuration - the GameConfiguration for this game type
See Also:
GameConfiguration

unregisterGameConfiguration

public void unregisterGameConfiguration(String gameType,
                                        boolean clearGamesByType)
Description copied from interface: ElectroServerApi
Removes a GameConfiguration from the GameManager, so that users can no longer create games of this gameType. Existing games of the same gameType should not be affected, and users may be able to join them. Note: if your application dynamically registers and unregisters gameTypes, you may notice a very small memory leak if you unregister the gameTypes while games exist of that type. To fix this, unregister each gameType twice: once to prevent new games from being created, and a second time later at a time when you know that no games of that type currently exist.

Specified by:
unregisterGameConfiguration in interface ElectroServerApi
Parameters:
gameType - to be unregistered
clearGamesByType - true to try to remove the entry from the gamesByType map

createGameForUsers

public GameManagerResponse createGameForUsers(String gameType,
                                              Collection<String> users,
                                              String zoneName,
                                              String password,
                                              boolean locked,
                                              boolean hidden,
                                              EsObject gameDetails)
Description copied from interface: ElectroServerApi

Used 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.

Specified by:
createGameForUsers in interface ElectroServerApi
Parameters:
gameType - the game type to create
users - a Collection of users to join to the game
zoneName - the name of the zone in which to create the game room - this zone will be created if needed
password - the password to establish on the game room, this password will be needed for any users to enter later
locked - 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)
Returns:
a response indicating the success or failure of this call
See Also:
GameManagerResponse, EsObject

createGameForUsers

public GameManagerResponse createGameForUsers(String gameType,
                                              String[] users,
                                              String zoneName,
                                              String password,
                                              boolean locked,
                                              boolean hidden,
                                              EsObject gameDetails)
Description copied from interface: ElectroServerApi

Used 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.

Specified by:
createGameForUsers in interface ElectroServerApi
Parameters:
gameType - the game type to create
users - an array of users to join to the game
zoneName - the name of the zone in which to create the game room - this zone will be created if needed
password - the password to establish on the game room, this password will be needed for any users to enter later
locked - 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)
Returns:
a response indicating the success or failure of this call
See Also:
GameManagerResponse, EsObject

carefullyCreateGameForUsers

public GameManagerResponse carefullyCreateGameForUsers(String gameType,
                                                       Collection<String> users,
                                                       String zoneName,
                                                       String password,
                                                       boolean locked,
                                                       boolean hidden,
                                                       EsObject gameDetails)
Description copied from interface: ElectroServerApi

Used 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.

Specified by:
carefullyCreateGameForUsers in interface ElectroServerApi
Parameters:
gameType - the game type to create
users - an array of users to join to the game
zoneName - the name of the zone in which to create the game room - this zone will be created if needed
password - the password to establish on the game room, this password will be needed for any users to enter later
locked - 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)
Returns:
a response indicating the success or failure of this call
See Also:
GameManagerResponse, EsObject

joinUserToGame

public GameManagerResponse joinUserToGame(int gameId,
                                          String username,
                                          String password)
Description copied from interface: ElectroServerApi
Joins a single user to an existing game, given the gameId and the password.

Specified by:
joinUserToGame in interface ElectroServerApi
Returns:
a response indicating the success or failure of this call

findGames

public com.electrotank.electroserver5.entities.GameRO[] findGames(String gameType,
                                                                  EsObject gameDetails)
Description copied from interface: ElectroServerApi
Returns an array of current games that match the criteria given, whether the games are locked or not. Does not include any hidden games.

Specified by:
findGames in interface ElectroServerApi
Parameters:
gameType - as registered with GameManager
gameDetails - that should match
Returns:
GameRO[] array of games that match this criteria

findGames

public com.electrotank.electroserver5.entities.GameRO[] findGames(String gameType,
                                                                  boolean locked,
                                                                  EsObject gameDetails)
Description copied from interface: ElectroServerApi
Returns an array of current games that match the criteria given. Does not include any hidden games.

Specified by:
findGames in interface ElectroServerApi
Parameters:
gameType - as registered with GameManager
locked - whether to search for locked games or unlocked games
gameDetails - that should match
Returns:
GameRO[] array of games that match this criteria

findGames

protected com.electrotank.electroserver5.entities.GameRO[] findGames(com.electrotank.electroserver5.entities.SearchCriteria criteria)

getUserFromName

protected com.electrotank.electroserver5.entities.ConnectedUser getUserFromName(String userName)

getUserByUserName

protected com.electrotank.electroserver5.entities.User getUserByUserName(String userName)

userIdForName

public Long userIdForName(String userName)
Description copied from interface: ElectroServerApi
Get the internal user ID for the specified user name

Specified by:
userIdForName in interface ElectroServerApi
Parameters:
userName - Name of user to get the ID for
Returns:
Null if the user is not connected (and thus no ID), otherwise their current user ID

userNameForId

public String userNameForId(long userId)
Description copied from interface: ElectroServerApi
Get the user name for the specified user ID

Specified by:
userNameForId in interface ElectroServerApi
Parameters:
userId - ID to get the user name for
Returns:
Null if the user is not connected, otherwise their current user name

getFileSystemApi

public EsFileSystemApi getFileSystemApi()
Description copied from interface: ElectroServerApi
Used to access the file system API functionality of the server.

Specified by:
getFileSystemApi in interface ElectroServerApi
Returns:
the FileSystemAPI
See Also:
EsFileSystemApi

getUserCount

public int getUserCount()
Description copied from interface: ElectroServerApi
Get the number of users currently logged in.

Specified by:
getUserCount in interface ElectroServerApi
Returns:
number of users

getServerVersion

public String getServerVersion()
Description copied from interface: ElectroServerApi
Get the server version.

Specified by:
getServerVersion in interface ElectroServerApi
Returns:
String that is the version of ElectroServer

getZoneCount

public int getZoneCount()
Description copied from interface: ElectroServerApi
Get the number of active zones.

Specified by:
getZoneCount in interface ElectroServerApi
Returns:
number of zones

getRoomCount

public int getRoomCount()
Description copied from interface: ElectroServerApi
Get the total number of active rooms in all zones.

Specified by:
getRoomCount in interface ElectroServerApi
Returns:
number of rooms

getServerUptime

public long getServerUptime()
Description copied from interface: ElectroServerApi
Get the number of milliseconds since the server was started.

Specified by:
getServerUptime in interface ElectroServerApi
Returns:
server uptime, in milliseconds

getServerUptimeString

public String getServerUptimeString()
Description copied from interface: ElectroServerApi
Get the number of days, hours and minutes since the server was started, formatted as a string y:DDD:HH:mm.

Specified by:
getServerUptimeString in interface ElectroServerApi
Returns:
server uptime, as a string.

sendGlobalPrivateMessage

public int sendGlobalPrivateMessage(String message)
Description copied from interface: ElectroServerApi
Sends a private message to every connected user, whether in a room or not. Sender will be marked as null. Clients would need to be listening for private messages.

Specified by:
sendGlobalPrivateMessage in interface ElectroServerApi
Parameters:
message - to be sent
Returns:
number of connected users

sendGlobalPluginMessage

public int sendGlobalPluginMessage(EsObjectRO variables)
Description copied from interface: ElectroServerApi
Sends a plugin message to every connected user, whether in a room or not. Clients would need to be listening for plugin messages.

Specified by:
sendGlobalPluginMessage in interface ElectroServerApi
Parameters:
variables - EsObject to be sent
Returns:
number of connected users

getGameTypesRegistered

public List<String> getGameTypesRegistered()
Description copied from interface: ElectroServerApi
Returns a list of all gameTypes registered with GameManager.

Specified by:
getGameTypesRegistered in interface ElectroServerApi
Returns:
list of gameTypes

getBuddies

public List<String> getBuddies(String userName)
Description copied from interface: ElectroServerApi
Gets the specified user's buddy list.

Specified by:
getBuddies in interface ElectroServerApi
Returns:
list of names of buddies

isBuddy

public boolean isBuddy(String userName,
                       String buddyName)
Description copied from interface: ElectroServerApi
Determines whether the specified user is buddies with buddyName.

Specified by:
isBuddy in interface ElectroServerApi
Returns:
true if buddyName is on userName's buddy list

getBuddyEsObject

public EsObject getBuddyEsObject(String userName,
                                 String buddyName)
Description copied from interface: ElectroServerApi
Gets the optional EsObject associated with a buddy in the specified user's buddy list. Result is null if there is no EsObject or if the buddy is not found in the buddy list.

Specified by:
getBuddyEsObject in interface ElectroServerApi
Returns:
value

getAllLanguageFilterNames

public List<String> getAllLanguageFilterNames()
Description copied from interface: ElectroServerApi
Returns a list of all language filter names

Specified by:
getAllLanguageFilterNames in interface ElectroServerApi
Returns:
list of language filter names

getAllFloodingFilterNames

public List<String> getAllFloodingFilterNames()
Description copied from interface: ElectroServerApi
Returns a list of all flooding filter names

Specified by:
getAllFloodingFilterNames in interface ElectroServerApi
Returns:
list of flooding filter names

getPermissionSetId

public String getPermissionSetId(String userName)
Description copied from interface: ElectroServerApi
Returns the id of the permission set for this user.

Specified by:
getPermissionSetId in interface ElectroServerApi
Parameters:
userName - of user
Returns:
permission set id

setPermissionSetId

public void setPermissionSetId(String userName,
                               String id)
Description copied from interface: ElectroServerApi
Sets the permission set id for a given user. Normally users do not get their permission sets changed after login. This method is intended for applications that use a two step login process. Valid permission set ids are displayed on the ES Admin's Permission Sets screen.

Specified by:
setPermissionSetId in interface ElectroServerApi
Parameters:
userName - of user

getBuddiesOnline

public List<String> getBuddiesOnline(String userName)
Description copied from interface: ElectroServerApi
Gets the specified user's buddy list, filtered to show only those buddies that are currently online.

Specified by:
getBuddiesOnline in interface ElectroServerApi
Returns:
list of names of buddies currently online

quickJoinGameWithBuddyForUser

public GameManagerResponse quickJoinGameWithBuddyForUser(String userName,
                                                         String gameType,
                                                         String zoneName,
                                                         EsObject gameDetails)
Description copied from interface: ElectroServerApi

Used 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.

Specified by:
quickJoinGameWithBuddyForUser in interface ElectroServerApi
Parameters:
userName - user that wants to join a game
gameType - the game type to join
zoneName - the name of the zone in which to create the game room - this zone will be created 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)
Returns:
a response indicating the success or failure of this call

quickJoinGameForUser

public GameManagerResponse quickJoinGameForUser(String userName,
                                                String gameType,
                                                String zoneName,
                                                EsObject gameDetails)
Description copied from interface: ElectroServerApi

Used 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.

Specified by:
quickJoinGameForUser in interface ElectroServerApi
Parameters:
userName - user that wants to join a game
gameType - the game type to join
zoneName - the name of the zone in which to create the game room - this zone will be created 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)
Returns:
a response indicating the success or failure of this call

findAllGamesWithBuddies

public FindGamesWithBuddiesResponse findAllGamesWithBuddies(String userName,
                                                            String gameType,
                                                            EsObject gameDetails)
Description copied from interface: ElectroServerApi

Finds 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.

Specified by:
findAllGamesWithBuddies in interface ElectroServerApi
Parameters:
userName - user that wants to know about games
gameType - the game type the user is interested in
gameDetails - the custom details of the game to be used in the SearchCriteria
Returns:
a response with information about all online buddies and what games they are each playing

findOneGameWithBuddies

public com.electrotank.electroserver5.entities.GameRO findOneGameWithBuddies(String userName,
                                                                             String gameType,
                                                                             EsObject gameDetails)
Description copied from interface: ElectroServerApi

Finds one game being played by a buddy of the specified user.

Specified by:
findOneGameWithBuddies in interface ElectroServerApi
Parameters:
userName - user that wants to know about games
gameType - the game type the user is interested in
gameDetails - the custom details of the game to be used in the SearchCriteria
Returns:
game being played by one of the user's buddies, or null if none found

getUserCountByZoneId

public int getUserCountByZoneId(int zoneId,
                                boolean distinct)
Description copied from interface: ElectroServerApi
Get the number of users in a given zone. Performance notes: this iterates through every room in the zone. If distinct is true, it takes a bit longer than if it is false.

Specified by:
getUserCountByZoneId in interface ElectroServerApi
Parameters:
zoneId - - zone
distinct - - if a user is in two rooms in this zone, should he be counted twice?
Returns:
count of users in the zone

getUserCountByZoneName

public int getUserCountByZoneName(String zoneName,
                                  boolean distinct)
Description copied from interface: ElectroServerApi
Get the number of users in a given zone. Performance notes: this iterates through every room in the zone. If distinct is true, it takes a bit longer than if it is false.

Specified by:
getUserCountByZoneName in interface ElectroServerApi
Parameters:
zoneName - - zone
distinct - - if a user is in two rooms in this zone, should he be counted twice?
Returns:

getUserCountByGameType

public int getUserCountByGameType(String gameType,
                                  boolean distinct)
Description copied from interface: ElectroServerApi
Get the number of users playing a certain game (specified by the gameType). Performance notes: this iterates through every room for this gameType. If distinct is true, it takes a bit longer than if it is false. This includes hidden games.

Specified by:
getUserCountByGameType in interface ElectroServerApi
Parameters:
gameType - as registered with GameManager
distinct - - if a user is in two games of this gameType, should he be counted twice?
Returns:

setSuppressBuddyEventsForUser

public void setSuppressBuddyEventsForUser(String userName,
                                          boolean value)
Description copied from interface: ElectroServerApi
Sets suppression of buddy events for the given user.

Specified by:
setSuppressBuddyEventsForUser in interface ElectroServerApi
Parameters:
userName - user to toggle events for
value - true to suppress the buddy events for this user, false to enable them

isSuppressBuddyEventsForUser

public boolean isSuppressBuddyEventsForUser(String userName)
Description copied from interface: ElectroServerApi
Returns a boolean indicating whether this user's buddy events are suppressed.

Specified by:
isSuppressBuddyEventsForUser in interface ElectroServerApi
Parameters:
userName - name of the user
Returns:
boolean true if buddy events are suppressed for this user

getAllConnectedUsers

public Collection<String> getAllConnectedUsers()
Description copied from interface: ElectroServerApi
Returns a collection of the usernames of all connected users.

Specified by:
getAllConnectedUsers in interface ElectroServerApi
Returns:
Collection all connected users

getIdleMillisecondsForUser

public long getIdleMillisecondsForUser(String userName)
Description copied from interface: ElectroServerApi
Returns the number of milliseconds that the specified user has been idle. Note: Users are checked for idleness approximately once every 60 seconds, so this will not allow you to determine the exact number of milliseconds or seconds before a user will be kicked for idleness.

Specified by:
getIdleMillisecondsForUser in interface ElectroServerApi
Parameters:
userName - of the user
Returns:
milliseconds idle

getUserIdleDisconnectTimeSeconds

public int getUserIdleDisconnectTimeSeconds()
Description copied from interface: ElectroServerApi
Returns the value of the Client Idle Disconnect Time from the ES Admin. This is the number of seconds allowed since the last time a client has sent a message to the server, before the server kicks this client for idleness.

Specified by:
getUserIdleDisconnectTimeSeconds in interface ElectroServerApi
Returns:
seconds of idleness allowed

getGameCountByType

public Map<String,Integer> getGameCountByType()
Description copied from interface: ElectroServerApi
Returns the number of current games of each game type registered by GameManager.

Specified by:
getGameCountByType in interface ElectroServerApi
Returns:
map of gameType to number of games of that gameType

getUserJoinedRooms

public List<RoomValue> getUserJoinedRooms(String userName)
Description copied from interface: ElectroServerApi
Returns a Collection of rooms that the specified user is currently joined to.

Specified by:
getUserJoinedRooms in interface ElectroServerApi
Returns:
collection of rooms

getUserJoinedGames

public List<com.electrotank.electroserver5.entities.GameRO> getUserJoinedGames(String userName)
Description copied from interface: ElectroServerApi
Returns a Collection of games that the specified user is currently joined to.

Specified by:
getUserJoinedGames in interface ElectroServerApi
Returns:
collection of games

suspendIdleKickingForUser

public void suspendIdleKickingForUser(String userName)
Description copied from interface: ElectroServerApi
Disables kicking for idleness for the specified user. This is suitable for a user who is starting to play a single player minigame during which no messages will be sent from client to server.

Specified by:
suspendIdleKickingForUser in interface ElectroServerApi

resumeIdleKickingForUser

public void resumeIdleKickingForUser(String userName)
Description copied from interface: ElectroServerApi
Enables kicking for idleness for the specified user. This is to be used after a previous call to suspendIdleKickingForUser.

Specified by:
resumeIdleKickingForUser in interface ElectroServerApi

setAutoIdleKickingForUser

public void setAutoIdleKickingForUser(String userName,
                                      boolean value)
Description copied from interface: ElectroServerApi
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.

Specified by:
setAutoIdleKickingForUser in interface ElectroServerApi
value - true to automatically resume idle kicking

grantOperatorStatus

public PluginApiResponse grantOperatorStatus(String userName,
                                             int zoneId,
                                             int roomId)
Description copied from interface: ElectroServerApi
Grants room operator status to the given user for the specified room. Possible errors returned: ZoneNotFound, RoomNotFound, UserNotJoinedToRoom

Specified by:
grantOperatorStatus in interface ElectroServerApi
Returns:
response indicating success or failure

revokeOperatorStatus

public PluginApiResponse revokeOperatorStatus(String userName,
                                              int zoneId,
                                              int roomId)
Description copied from interface: ElectroServerApi
Revokes room operator status to the given user for the specified room. Possible errors returned: ZoneNotFound, RoomNotFound, UserNotJoinedToRoom

Specified by:
revokeOperatorStatus in interface ElectroServerApi
Returns:
response indicating success or failure

isRoomOperator

public boolean isRoomOperator(String userName,
                              int zoneId,
                              int roomId)
Description copied from interface: ElectroServerApi
Returns true if the given user has room operator status for the specified room. Note: Will return false if the room does not exist.

Specified by:
isRoomOperator in interface ElectroServerApi
Returns:
true if the userName has room operator status for this room

getRoomOperators

public List<String> getRoomOperators(int zoneId,
                                     int roomId)
Description copied from interface: ElectroServerApi
Gets a list of all users who have room operator status for the given room. If the room does not exist, returns null. If the room exists but has no operator, returns an empty list.

Specified by:
getRoomOperators in interface ElectroServerApi
Returns:
list of operators

getUserServerVariables

public Collection<ReadOnlyUserServerVariable> getUserServerVariables(String userName)
Description copied from interface: ElectroServerApi
Looks up and returns all the user server variables for a given user. The user must be logged in, so this will not work inside a LoginEventHandler.

Specified by:
getUserServerVariables in interface ElectroServerApi
Parameters:
userName - the user name
Returns:
a collection of read-only user server variables

liftRoomBanForUser

public RoomResponse liftRoomBanForUser(String userName,
                                       int zoneId,
                                       int roomId)
Description copied from interface: ElectroServerApi
Removes a ban on a specified user, for a specified room.

Specified by:
liftRoomBanForUser in interface ElectroServerApi
Returns:
response indicating success or failure

getRoom

public RoomValue getRoom(int zoneId,
                         int roomId)
Description copied from interface: ElectroServerApi
Gets information about a single room, given the zoneId and roomId.

Specified by:
getRoom in interface ElectroServerApi
Returns:
room

getRooms

public Collection<RoomValue> getRooms(int zoneId,
                                      String roomName)
Description copied from interface: ElectroServerApi
Gets information about all rooms in the zone specified that have the specified room name.

Specified by:
getRooms in interface ElectroServerApi
Returns:
collection of rooms

getRooms

public Collection<RoomValue> getRooms(String zoneName,
                                      int roomId)
Description copied from interface: ElectroServerApi
Gets information about all rooms with the specified roomId that are in a zone with the specified zone name.

Specified by:
getRooms in interface ElectroServerApi
Returns:
collection of rooms

getRooms

public Collection<RoomValue> getRooms(String zoneName,
                                      String roomName)
Description copied from interface: ElectroServerApi
Gets information about all rooms with the specified room name that are in a zone with the specified zone name.

Specified by:
getRooms in interface ElectroServerApi
Returns:
collection of rooms

disableAllLogins

public void disableAllLogins()
Description copied from interface: ElectroServerApi
Disables users from logging in. If a user tries to log in after this is used, the error returned is ErrorType.LoginsAreDisabled

Specified by:
disableAllLogins in interface ElectroServerApi

enableLogins

public void enableLogins()
Description copied from interface: ElectroServerApi
Allows users to start logging in again, after disableAllLogins was previously used.

Specified by:
enableLogins in interface ElectroServerApi

areLoginsEnabled

public boolean areLoginsEnabled()
Description copied from interface: ElectroServerApi
Returns true if users are currently allowed to log in.

Specified by:
areLoginsEnabled in interface ElectroServerApi
Returns:
boolean indicating whether logins are enabled

getConnectedUsers

public Collection<String> getConnectedUsers()
Description copied from interface: ElectroServerApi
Gets a list of the usernames of all users currently logged in. This is not a live list; that is, it is a snapshot that will not change as users log in and log out.

Specified by:
getConnectedUsers in interface ElectroServerApi
Returns:
list of usernames

kickAllUsers

public void kickAllUsers()
Description copied from interface: ElectroServerApi
Kicks all connected users off the server. Logins are disabled first, and will remain disabled until enableLogins is called. In normal usage this is called prior to some extension cleanup work before a server restart, so we would want logins to remain disabled.

Specified by:
kickAllUsers in interface ElectroServerApi

getLogoutType

public com.electrotank.electroserver5.enumerations.ErrorType getLogoutType(String userName)
Description copied from interface: ElectroServerApi
For use in LogoutEventHandler. Gets the type of logout. If the user is logged in, this will be UserAlreadyLoggedIn.

Specified by:
getLogoutType in interface ElectroServerApi
Returns:
logout type

getLogoutReason

public EsObjectRO getLogoutReason(String userName)
Description copied from interface: ElectroServerApi
For use in LogoutEventHandler. Gets the optional reason for the logout.

Specified by:
getLogoutReason in interface ElectroServerApi
Returns:
EsObject reason

getUserClientType

public String getUserClientType(String userName)
Description copied from interface: ElectroServerApi
Gets a String representing the type of client a given user has, such as 'ActionScript3', 'CSharpUnity', etc. Default is 'Unknown', which will include all clients compiled using a client api prior to 5.3.2.

Specified by:
getUserClientType in interface ElectroServerApi
Returns:
client type

getUserClientVersion

public String getUserClientVersion(String userName)
Description copied from interface: ElectroServerApi
Gets the version of the client api that a given user's client used, such as '5.3.2'. Default is 'null', which will include all clients compiled using a client api prior to 5.3.2.

Specified by:
getUserClientVersion in interface ElectroServerApi
Returns:
client version

getUserIdleWarningTimeMS

public int getUserIdleWarningTimeMS(String userName)
Description copied from interface: ElectroServerApi
Returns the value of the Client Idle Warning Time for the specified user, in milliseconds. When a user has less than this amount of time left before being kicked for idleness, approximately once per minute the server will send an IdleTimeWarningEvent (added in ES5.3.3). Default value is 60001.

Specified by:
getUserIdleWarningTimeMS in interface ElectroServerApi
Returns:
warning time in milliseconds

setUserIdleWarningTimeMS

public void setUserIdleWarningTimeMS(String userName,
                                     int durationMS)
Description copied from interface: ElectroServerApi
Sets the value of the Client Idle Warning Time for the specified user, in milliseconds. When a user has less than this amount of time left before being kicked for idleness, approximately once per minute the server will send an IdleTimeWarningEvent (added in ES5.3.3). Default value is 60001.

Specified by:
setUserIdleWarningTimeMS in interface ElectroServerApi

shutdownServer

public void shutdownServer()
Description copied from interface: ElectroServerApi
Shuts down the ES5 server, as if the shutdown button on the ES Admin were clicked.

Specified by:
shutdownServer in interface ElectroServerApi

restartServer

public void restartServer()
Description copied from interface: ElectroServerApi
Restarts the ES5 server, as if the restart button on the ES Admin were clicked. Will not work if you are running ES5 as a service.

Specified by:
restartServer in interface ElectroServerApi

sendPublicMessageToRoomFromPlugin

public PluginApiResponse sendPublicMessageToRoomFromPlugin(String userName,
                                                           int zoneId,
                                                           int roomId,
                                                           String message,
                                                           EsObject esObject,
                                                           boolean executePublicMessageEventHandlers,
                                                           boolean executePluginUserSendPublicMessage)
Description copied from interface: ElectroServerApi
Sends a public message to the specified room, marked as coming from the specified userName. This userName does not have to be an online user, but it cannot be null. This method is useful for NPCs, since it allows them to appear to be chatting. Note that this will bypass any language filter or flooding filter on the room.

Specified by:
sendPublicMessageToRoomFromPlugin in interface ElectroServerApi
Parameters:
userName - - name that the message will appear to be from
zoneId - - zoneId of the room
roomId - - roomId of the room
message - - message to be delivered
esObject - - optional EsObject for the message
executePublicMessageEventHandlers - - 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.
Returns:
PluginApiResponse indicating success or failure

sendPrivateMessageToUserFromPlugin

public PluginPrivateMessageResponse sendPrivateMessageToUserFromPlugin(String fromName,
                                                                       String toName,
                                                                       String message,
                                                                       EsObject esObject,
                                                                       boolean executePrivateMessageEventHandlers)
Description copied from interface: ElectroServerApi
Sends a private chat message to the specified user, marked as coming from the specified userName. This userName does not have to be an online user, but it cannot be null. This method is useful for NPCs.

Specified by:
sendPrivateMessageToUserFromPlugin in interface ElectroServerApi
Parameters:
fromName - - name that the message will appear to be from
toName - - username of the recipient
message - - message to be sent
esObject - - optional EsObject
executePrivateMessageEventHandlers - - if true, any server level PrivateMessageEventHandler will be executed. This is useful if you have a chat logger for private chat, for example.
Returns:
PluginPrivateMessageResponse indicating success or failure.

sendPrivateMessageToUsersFromPlugin

public PluginPrivateMessageResponse sendPrivateMessageToUsersFromPlugin(String fromName,
                                                                        String[] toNames,
                                                                        String message,
                                                                        EsObject esObject,
                                                                        boolean executePrivateMessageEventHandlers)
Description copied from interface: ElectroServerApi
Sends a private chat message to the specified array of users, marked as coming from the specified userName. This userName does not have to be an online user, but it cannot be null. This method is useful for NPCs.

Specified by:
sendPrivateMessageToUsersFromPlugin in interface ElectroServerApi
Parameters:
fromName - - name that the message will appear to be from
toNames - - array of usernames (the recipients)
message - - message to be sent
esObject - - optional EsObject
executePrivateMessageEventHandlers - - if true, any server level PrivateMessageEventHandler will be executed. This is useful if you have a chat logger for private chat, for example.
Returns:
PluginPrivateMessageResponse indicating success, partial success, or failure. Response will include a list of invalid usernames if any of the recipients were not found online.

sendCreateOrJoinGameResponse

public void sendCreateOrJoinGameResponse(String userName,
                                         GameManagerResponse response)
Description copied from interface: ElectroServerApi
Sends a CreateOrJoinGameResponse to the specified user, based on the GameManagerResponse. This is intended to be used after a plugin uses one of the various methods that adds a user to a game, because those methods do not send the response automatically, the way that a client's request to join a game would send the response. Please note that if the plugin used carefullyCreateGameForUsers, the GameManagerResponse would indicate success if only one of several users was added to the game, so the plugin should check the list of users in the game room before sending this response.

Specified by:
sendCreateOrJoinGameResponse in interface ElectroServerApi


Copyright © 2007-2010 Electrotank, Inc. All Rights Reserved.