com.electrotank.electroserver4.extensions
Class BasePlugin

java.lang.Object
  extended by com.electrotank.electroserver4.extensions.BasePlugin
All Implemented Interfaces:
ExtensionLifeCycle, Plugin, PluginInterop, PluginLifeCycle, PluginRequest, RoomUserEvents, RoomVariableEvents

public abstract class BasePlugin
extends Object
implements Plugin, PluginLifeCycle, PluginRequest, PluginInterop, RoomUserEvents, RoomVariableEvents


Constructor Summary
BasePlugin()
          Creates a new instance of BasePlugin
 
Method Summary
 void destroy()
          Automatically invoked when the object class is destroyed.
 PluginApi getApi()
           
 void init(EsObjectRO parameters)
          Automatically invoked when the object class is instantiated, after api is available.
 EsObject interop(EsObjectRO requestParameters)
          Allows one plugin to send a message to another plugin, in a different extension.
 void request(String userName, EsObjectRO requestParameters)
          Handles a request from a specific user.
 void roomVariableCreated(String userName, ReadOnlyRoomVariable variable)
           
 void roomVariableDeleted(String userName, ReadOnlyRoomVariable variable)
           
 void roomVariableUpdated(String userName, ReadOnlyRoomVariable variable, EsObjectRO oldValue)
           
 void setApi(PluginApi api)
           
 void userBanned(String userName, String message, int duration)
          Actions triggered when a user is banned from the server.
 ChainAction userEnter(UserEnterContext context)
          Actions triggered when a user enters the room.
 void userExit(String userName)
          Actions triggered when a user exits the room.
 void userKicked(String userName, String message)
          Actions triggered when a user is kicked from a room.
 ChainAction userSendPublicMessage(UserPublicMessageContext message)
          Actions triggered when a user sends a public message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasePlugin

public BasePlugin()
Creates a new instance of BasePlugin

Method Detail

init

public void init(EsObjectRO parameters)
Description copied from interface: ExtensionLifeCycle
Automatically invoked when the object class is instantiated, after api is available. Usually initializes the extension's ExtensionComponentConfiguration, RoomConfiguration, and if it is a game, the GameConfiguration. If there are any variables for the plugin in the Extension.xml file, they will be found in the parameters EsObjectRO.

Specified by:
init in interface ExtensionLifeCycle
Parameters:
parameters - EsObjectRO that may contain XML parameters to be read
See Also:
EsObjectRO, ExtensionComponentConfiguration, RoomConfiguration, GameConfiguration

request

public void request(String userName,
                    EsObjectRO requestParameters)
Description copied from interface: PluginRequest
Handles a request from a specific user. Normally this request comes from a client using ElectroServer.send.

Specified by:
request in interface PluginRequest
Parameters:
userName - name of the user
requestParameters - EsObjectRO containing information about the request

interop

public EsObject interop(EsObjectRO requestParameters)
Description copied from interface: PluginInterop
Allows one plugin to send a message to another plugin, in a different extension.

Specified by:
interop in interface PluginInterop
Parameters:
requestParameters - request
Returns:
EsObject reply
See Also:
ElectroServerApi.callRoomPlugin, ElectroServerApi.callServerPlugin, ElectroServerApi.getRoomPlugin, ElectroServerApi.getServerPlugin

userEnter

public ChainAction userEnter(UserEnterContext context)
Description copied from interface: RoomUserEvents
Actions triggered when a user enters the room.

Specified by:
userEnter in interface RoomUserEvents
Parameters:
context - UserEnterContext
Returns:
ChainAction.OkAndContinue for a successful entry
See Also:
"PluginUserEnterAndExit example plugin"

userSendPublicMessage

public ChainAction userSendPublicMessage(UserPublicMessageContext message)
Description copied from interface: RoomUserEvents
Actions triggered when a user sends a public message.

Specified by:
userSendPublicMessage in interface RoomUserEvents
Parameters:
message - UserPublicMessageContext
Returns:
ChainAction.OkAndContinue for a successful message
See Also:
"PluginPigLatin example plugin"

userExit

public void userExit(String userName)
Description copied from interface: RoomUserEvents
Actions triggered when a user exits the room.

Specified by:
userExit in interface RoomUserEvents
Parameters:
userName - user who left
See Also:
"PluginUserEnterAndExit example plugin"

roomVariableCreated

public void roomVariableCreated(String userName,
                                ReadOnlyRoomVariable variable)
Specified by:
roomVariableCreated in interface RoomVariableEvents

roomVariableUpdated

public void roomVariableUpdated(String userName,
                                ReadOnlyRoomVariable variable,
                                EsObjectRO oldValue)
Specified by:
roomVariableUpdated in interface RoomVariableEvents

roomVariableDeleted

public void roomVariableDeleted(String userName,
                                ReadOnlyRoomVariable variable)
Specified by:
roomVariableDeleted in interface RoomVariableEvents

userKicked

public void userKicked(String userName,
                       String message)
Description copied from interface: RoomUserEvents
Actions triggered when a user is kicked from a room.

Specified by:
userKicked in interface RoomUserEvents
Parameters:
userName - user who was kicked
message - reason for the kick

userBanned

public void userBanned(String userName,
                       String message,
                       int duration)
Description copied from interface: RoomUserEvents
Actions triggered when a user is banned from the server.

Specified by:
userBanned in interface RoomUserEvents
Parameters:
userName - user who was banned
message - reason for the ban
duration - duration of the ban in seconds

destroy

public void destroy()
Description copied from interface: ExtensionLifeCycle
Automatically invoked when the object class is destroyed.

Specified by:
destroy in interface ExtensionLifeCycle

getApi

public PluginApi getApi()
Specified by:
getApi in interface Plugin

setApi

public void setApi(PluginApi api)
Specified by:
setApi in interface Plugin


Copyright © 2007 Electrotank, Inc. All Rights Reserved.