|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.electrotank.electroserver.plugins.utilities.BaseExtensionHelper
The BaseExtensionHelper is a class that exposes internal functionality of ElectroServer to extensions. While the functionality listed here is available to both plugins and event handlers, in practice you will use the appropriate subclass like PluginHelper.
Constructor Summary | |
BaseExtensionHelper(String name,
People people,
Places places)
The is an interally-used constructor. |
Method Summary | |
void |
ban(String userName,
long expires)
Bans the user from the server for the specified period. |
Map |
callRemotePlugin(String pluginName,
Map parameters)
Calls a remote server-level plugin specified by the name. |
Map |
callRemoteRoomPlugin(String zoneName,
String roomName,
String pluginName,
Map parameters)
Calls a remote room-level plugin specified by the name. |
void |
config(String message)
Creates a "config" entry in the server log file. |
boolean |
createDirectory(String path)
Creates the directory and all needed parent directories specified by the path. |
int |
createRoom(String doc)
Progamatically creates a room with no users in it. |
boolean |
createRoomVariable(String zoneName,
String roomName,
boolean locked,
String name,
String data)
Creates a room variable in a given zone/room combination. |
boolean |
createUserVariable(String userName,
String variableName,
String variableValue)
Creates a user variable for the specified user. |
boolean |
deleteDirectory(String path)
Deletes the directory specified by the path. |
boolean |
deleteFile(String path)
Deletes the file specified by the path. |
boolean |
deleteRoomVariable(String zoneName,
String roomName,
String name)
Deletes a given room variable from the system. |
boolean |
deleteUserVariable(String userName,
String variableName)
Deletes the specified user variable. |
boolean |
doesDirectoryExist(String path)
Determines if a directory exists. |
boolean |
doesFileExist(String path)
Determines if a file exists. |
void |
fine(String message)
Creates a "fine" entry in the server log file. |
void |
finer(String message)
Creates a "finer" entry in the server log file. |
void |
finest(String message)
Creates a "finest" entry in the server log file. |
ZoneStub[] |
getAllZones()
Gets all zones on the server. |
double |
getCpuPercentUsed()
|
int |
getLoggedInUserCount()
Returns a count of all users currently logged into the server. |
Logger |
getLogger()
Returns the server-wide logger that can be used to log anything needed |
String |
getName()
Returns the name of the extension (plugin or event handler) |
long |
getPhysicalMemoryAvailable()
|
RoomStub[] |
getRoomsInZone(String zoneName)
Gets all rooms in a given zone. |
RoomVariable[] |
getRoomVariables(String zoneName,
String roomName)
Gets all room variables for a zone/room combination.Updating the RoomVariable objects returned by this call will NOT update the actual room variables. |
long |
getServerTime()
Gets the current time of the server. |
Object |
getUserServerVariable(String userName,
Object key)
Returns the specified user server variable. |
Object |
getUserServerVariable(String userName,
Object key,
Object defaultValue)
Returns the specified user server variable. |
UserStub[] |
getUsersInRoom(String zoneName,
String roomName)
Returns a list of users from a given zone/room combination. |
UserVariable[] |
getUserVariables(String userName)
Returns all user variables associated with the specified user. |
Map |
getUserVariablesAsMap(String userName)
Gets a Map of all user variables tied to this user. |
void |
info(String message)
Creates a "info" entry in the server log file. |
boolean |
isDirectory(String path)
Determines if the specified path is a directory. |
boolean |
isFile(String path)
Determines if the specified path is a file. |
boolean |
isUserLoggedIn(String userName)
Determines if the user is logged in or not. |
void |
kick(String userName)
Kicks the user specified from the server. |
int |
moveToRoom(String userName,
String zone,
String room,
String roomPassword,
boolean numbered)
Moves a user into a room progamatically. |
String |
readFile(String fileName)
Reads the specified file and returns the contents as a String. |
void |
removeUserServerVariable(String userName,
Object key)
Removes a user server variable from a given user. |
void |
sendPrivateMessage(String userName,
String message,
Map variables)
Sends a private message to the userName. |
void |
sendPrivateMessgeToMany(String[] users,
String message,
Map variables)
Sends a private message to the specified users. |
boolean |
sendPublicMessageToRoom(String zoneName,
String roomName,
String message,
Map variables)
Sends a plugin message to the given zone/room combination. |
boolean |
sendPublicMessageToServer(String message,
Map variables)
Sends a public message to the entire server. |
boolean |
sendPublicMessageToZone(String zoneName,
String message,
Map variables)
Sends a public message to a zone. |
void |
setUserServerVariable(String userName,
Object key,
Object value)
Sets a variable on a user. |
void |
severe(String message)
Creates a "severe" entry in the server log file. |
boolean |
stringContainsVulgarity(String testString)
Tests the given string for vulgarity using the LanguageFilter and the settings initialized in the configuration.xml file. |
boolean |
updateRoomVariable(String zoneName,
String roomName,
boolean locked,
String name,
String data)
Updates a given user variables settings and values. |
boolean |
updateUserVariable(String userName,
String variableName,
String variableValue)
Updates a given user variable with the new data. |
void |
warning(String message)
Creates a "warning" entry in the server log file. |
boolean |
writeFile(String fileName,
String data,
boolean append)
Writes a file to the specified location. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BaseExtensionHelper(String name, People people, Places places)
name
- the name of the extension using this instance of the helperpeople
- a reference to the people object of the serverplaces
- a reference to the places object of the serverMethod Detail |
public void kick(String userName)
userName
- name of the user to kickpublic void ban(String userName, long expires)
userName
- name of the user to kickexpires
- length of time (in milliseconds) that the user should be bannedpublic void setUserServerVariable(String userName, Object key, Object value)
userName
- The username of the user this variable will be associated withkey
- The name to use as an identifier for this variablevalue
- The variable to store.public void removeUserServerVariable(String userName, Object key)
userName
- The name of the userkey
- The name of the variable to removepublic Object getUserServerVariable(String userName, Object key)
userName
- The name of the userkey
- The name of the variable
public Object getUserServerVariable(String userName, Object key, Object defaultValue)
userName
- The name of the userkey
- The name of the variabledefaultValue
- A value to be used if the variable is not found
public void sendPrivateMessgeToMany(String[] users, String message, Map variables)
users
- string array representing the names of users to receive this messagemessage
- text of the message to sendvariables
- variables to be sent along with the messagepublic void sendPrivateMessage(String userName, String message, Map variables)
userName
- name of the userName to receive this messagemessage
- text of the message to sendvariables
- variables to be sent along with the messagepublic boolean isUserLoggedIn(String userName)
userName
- The username to use
public Map callRemotePlugin(String pluginName, Map parameters) throws PluginException
pluginName
- name of the server-level plugin to callparameters
- map of the parameters to be passed to the plugin
PluginException
- thrown if there is an error in executing the requestpublic Map callRemoteRoomPlugin(String zoneName, String roomName, String pluginName, Map parameters) throws PluginException
zoneName
- name of the zone containg the room and plugin to callroomName
- name of the room containg the plugin to callpluginName
- name of the server-level plugin to callparameters
- map of the parameters to be passed to the plugin
PluginException
- thrown if there is an error in executing the requestpublic boolean writeFile(String fileName, String data, boolean append)
fileName
- path and name of the file to write todata
- the data to be written to the fileappend
- appends the data to the file if it exists
public String readFile(String fileName)
fileName
- path and name of the file to read
public boolean isDirectory(String path)
path
- the path to check
public boolean isFile(String path)
path
- the path to check
public boolean doesFileExist(String path)
path
- the path/name of the file to check
public boolean doesDirectoryExist(String path)
path
- the path/name of the file to check
public boolean createDirectory(String path)
path
- the path/name of the directory to create
public boolean deleteDirectory(String path)
path
- path of the directory to delete
public boolean deleteFile(String path)
path
- the path/name of the file to delete
public long getServerTime()
public void severe(String message)
message
- the contents to enter into the logpublic void warning(String message)
message
- the contents to enter into the logpublic void info(String message)
message
- the contents to enter into the logpublic void config(String message)
message
- the contents to enter into the logpublic void fine(String message)
message
- the contents to enter into the logpublic void finer(String message)
message
- the contents to enter into the logpublic void finest(String message)
message
- the contents to enter into the logpublic String getName()
public Logger getLogger()
public UserVariable[] getUserVariables(String userName)
userName
- the name of the user
public Map getUserVariablesAsMap(String userName)
Map
of all user variables tied to this user. Both the key
and the value are strings.
userName
- the name of the user to use when looking for the variables.
Map
containing all the user variables tied to this user.public boolean createUserVariable(String userName, String variableName, String variableValue)
userName
- the name of the uservariableName
- the name of the variablevariableValue
- the value of the variable
public boolean updateUserVariable(String userName, String variableName, String variableValue)
userName
- the name of the uservariableName
- the name of the variablevariableValue
- the value of the variable
public boolean deleteUserVariable(String userName, String variableName)
userName
- the name of the uservariableName
- the name of the variable
public RoomVariable[] getRoomVariables(String zoneName, String roomName)
zoneName
- the name of the zoneroomName
- the name of the room
public boolean createRoomVariable(String zoneName, String roomName, boolean locked, String name, String data)
zoneName
- the name of the zoneroomName
- the name of the roomlocked
- true if this room variable is locked and can't be changed without unlockingname
- the name of the room variabledata
- the value of the variable
public boolean updateRoomVariable(String zoneName, String roomName, boolean locked, String name, String data)
zoneName
- the name of the zoneroomName
- the name of the roomlocked
- true if this varlable is locked, false otherwisename
- the name of the room variable to editdata
- the value of the room variable
public boolean deleteRoomVariable(String zoneName, String roomName, String name)
zoneName
- the name of the zoneroomName
- the name of the roomname
- the name of the room variable to delete
public boolean sendPublicMessageToRoom(String zoneName, String roomName, String message, Map variables)
zoneName
- the name of the zoneroomName
- the name of the roommessage
- the message to sendvariables
- variables associated with the message
public boolean sendPublicMessageToZone(String zoneName, String message, Map variables)
zoneName
- the name of the zonemessage
- the message to sendvariables
- variables associated with the message
public boolean sendPublicMessageToServer(String message, Map variables)
message
- the message to sendvariables
- variables associated with the message
public ZoneStub[] getAllZones()
public RoomStub[] getRoomsInZone(String zoneName)
zoneName
- the name of the zone.
public UserStub[] getUsersInRoom(String zoneName, String roomName)
zoneName
- the name of the zoneroomName
- the name of the room
public int getLoggedInUserCount()
public int createRoom(String doc)
doc
- the XML string containing the room definition.
public int moveToRoom(String userName, String zone, String room, String roomPassword, boolean numbered)
userName
- the username of the user to move.zone
- the name of the zone in which the room resides.room
- the name of the room.roomPassword
- the password for the room.numbered
- a flag to indicate if this user should be numbered or not.
public long getPhysicalMemoryAvailable()
public double getCpuPercentUsed()
public boolean stringContainsVulgarity(String testString)
testString
- the string to test.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |