|
|||||||||
Atavism Version 2018.1 | AGIS API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatavism.server.engine.EnginePlugin
atavism.server.plugins.ProxyPlugin
public class ProxyPlugin
The ProxyPlugin is the sole plugin charged to communicate with clients. The onActivate method opens both TCP and RDP listeners, both on the same port, allowing clients to connect over TCP and RDP.
Messages from other plugins are delvered to the PluginMessageCallback's handleMessage() method by the MessageAgent, and are queued in a SquareQueue instance based on the player oid for which they are intended.
Similarly, events stream in from clients via calls to the processPacket() method, where the events are parsed and and queued in another SquareQueue reserved for events. Ultimately the SquareQueue calls a callback to process the event.
ProxyPlugin.PluginMessageCallback.handleMessage(atavism.msgsys.Message, int)
,
SquareQueue
,
ProxyPlugin.EventCallback.doWork(java.lang.Object, java.lang.Object)
,
processPacket(atavism.server.network.ClientConnection, atavism.server.network.AOByteBuffer)
Nested Class Summary | |
---|---|
static class |
ProxyPlugin.AddStaticPerceptionMessage
|
static interface |
ProxyPlugin.CommandAccessCheck
Interface for access checking slash commands. |
static interface |
ProxyPlugin.CommandParser
Interface for handling client command events. |
class |
ProxyPlugin.EventCallback
The callback called by the SquareQueue holding messages from clients. |
static class |
ProxyPlugin.PlayerLoginStatus
|
class |
ProxyPlugin.PlayerMessageCallback
The Handler for player-specific messages coming in from other plugins. |
class |
ProxyPlugin.PluginMessageCallback
Handler for non-player-specific messages |
protected class |
ProxyPlugin.ProxyJMX
|
static interface |
ProxyPlugin.ProxyJMXMBean
|
Field Summary | |
---|---|
java.lang.String |
capacityError
The error message issued if too many clients try to log in. |
protected int |
clientPort
|
protected java.util.concurrent.locks.Lock |
commandMapLock
|
boolean |
defaultAllowClientToClientMessage
Default value of allowClientToClientMessage() when there is no method over-ride. |
protected java.util.Map<java.lang.String,java.util.List<ProxyExtensionHook>> |
extensionHooks
|
protected java.util.HashMap<java.lang.String,MessageType> |
extensionMessageRegistry
|
protected java.util.List<MessageType> |
extraPlayerMessageTypes
|
static int |
idleTimeout
Player idle timeout in seconds. |
protected static Logger |
log
|
static int |
maxByteCountBeforeConnectionReset
If the client connection has more than this number of message bytes queued, reset the client connection |
static int |
MaxConcurrentUsers
The number of concurrent users allowed in the game. login will fail if there are this many users online. |
static int |
maxMessagesBeforeConnectionReset
If the client connection has more than this number of messages queued, reset the client connection |
static MessageType |
MSG_TYPE_ACCOUNT_LOGIN
|
static MessageType |
MSG_TYPE_ADD_STATIC_PERCEPTION
|
static MessageType |
MSG_TYPE_GET_MATCHING_PLAYERS
|
static MessageType |
MSG_TYPE_GET_PLAYER_LOGIN_STATUS
|
static MessageType |
MSG_TYPE_LOGIN_SPAWNED
|
static MessageType |
MSG_TYPE_LOGOUT_PLAYER
|
static MessageType |
MSG_TYPE_PLAYER_IGNORE_LIST
|
static MessageType |
MSG_TYPE_PLAYER_IGNORE_LIST_REQ
|
static MessageType |
MSG_TYPE_PLAYER_PATH_REQ
|
static MessageType |
MSG_TYPE_RELAY_UPDATE_PLAYER_IGNORE_LIST
|
static MessageType |
MSG_TYPE_REMOVE_STATIC_PERCEPTION
|
static MessageType |
MSG_TYPE_UPDATE_PLAYER_IGNORE_LIST
|
static MessageType |
MSG_TYPE_VOICE_PARMS
|
static int |
PERCEPTION_GAIN_THRESHOLD
|
protected PerceptionFilter |
perceptionFilter
|
protected long |
perceptionSubId
|
protected PlayerManager |
playerManager
|
protected TimeHistogram |
proxyCallbackHistogram
|
protected TimeHistogram |
proxyQueueHistogram
|
protected PerceptionFilter |
responderFilter
|
protected long |
responderSubId
|
java.lang.String |
serverCapabilitiesSentToClient
This is a comma-separated list of capabilities that will be sent to the client in the LoginResponseEvent, intended to tell the client what the server can do. |
protected RDPServerSocket |
serverSocket
|
static int |
silenceLoadingTimeout
Player silence timeout in seconds while they are loading a scene. |
static int |
silenceTimeout
Player silence timeout in seconds. |
java.lang.String |
tokenError
The error message issued if there's a secure token error. |
protected static java.lang.String |
voiceServerHost
For now, just one voice plugin. |
protected static java.lang.Integer |
voiceServerPort
|
Fields inherited from interface atavism.msgsys.MessageCallback |
---|
NO_FLAGS, RESPONSE_EXPECTED |
Constructor Summary | |
---|---|
ProxyPlugin()
The ProxyPlugin constructor tells the underlying engine that it is, in fact, the proxy plugin, and creates a series of message counters for debugging purposes. |
Method Summary | |
---|---|
void |
acceptConnection(ClientConnection con)
Registers the proxy plugin instance as the message handler for the client connection. |
void |
addAdmin(OID oid)
Adds an oid to the list of players which are allowed to log in even when the server reaches MaxConcurrentUsers |
void |
addExtraPlayerExtensionMessageType(MessageType messageType)
Additional extension message type to add to proxy's player subscription filter. |
void |
addExtraPlayerMessageType(MessageType messageType)
Additional message type to add to proxy's player subscription filter. |
void |
addFilteredProperty(java.lang.String filteredProperty)
An entrypoint that allows Python code to add a filtered property, which is a property that is _not_ sent to any client. |
void |
addPlayerMessage(Message message,
Player player)
Add message directly to player's message queue. |
void |
addPlayerSpecificProperty(java.lang.String filteredProperty)
An entrypoint that allows Python code to add a player-specific property, which is a property that is _not_ sent to any client except the client running the player with the property. |
void |
addProxyExtensionHook(java.lang.String subType,
ProxyExtensionHook hook)
Call hook when client sends extension message sub-type. |
static void |
addStaticPerception(OID playerOid,
OID oid)
|
static void |
addStaticPerception(OID oid,
OID oid2,
java.lang.String name,
ObjectType type)
|
boolean |
allowClientToClientMessage(Player sender,
OID targetOid,
WorldManagerClient.TargetedExtensionMessage message)
Return true if the message is allowed from sending to target player. |
void |
connectionReset(ClientConnection con)
Method to log a client out, by asking the PlayerManager to set its status to logged out, and enqueuing a ConnectionResetMessage in the player's event SquareQueue. |
protected java.lang.Object |
createMBeanInstance()
Return JMX MBean instance object. |
java.util.Set<OID> |
getAdmins()
Returns a set of admin oids |
MessageType |
getExtensionMessageType(java.lang.String subtype)
Get server message type for an extension message sub-type. |
java.util.List<MessageType> |
getExtraPlayerMessageTypes()
|
InstanceEntryCallback |
getInstanceEntryCallback()
Get the instance entry callback. |
Player |
getPlayer(OID oid)
Get player. |
java.util.List<java.lang.String> |
getPlayerNames()
Used by the /who command to get the set of player names. |
java.util.Set<OID> |
getPlayerOids()
Used by the /dirlight command to get the set of player oids. |
java.util.List<Player> |
getPlayers()
Get the players using this proxy. |
java.util.Map<java.lang.String,java.util.List<ProxyExtensionHook>> |
getProxyExtensionHooks(java.lang.String subType)
|
ProxyLoginCallback |
getProxyLoginCallback()
Get the login callback. |
java.util.Map<java.lang.String,java.lang.String> |
getStatusMap()
Override to provide plugin status. |
protected void |
handleFreeRoad(ClientConnection con,
OID objOid)
Tell the client to free the road represented by the objOid. |
static OID |
handleFullInstance(int instanceTemplateID,
InstanceClient.InstanceInfo instanceInfo)
Used to find or generate a new instance that is not full when the instance a player wants to join is full. |
void |
incrementChatCount()
|
void |
incrementPrivateChatCount()
|
protected void |
initializeVoiceServerInformation()
|
boolean |
isAdmin(OID playerOid)
Returns true if the oid is in the set of admins; false otherwise. |
boolean |
isDevMode()
True if the proxy is running in development mode. |
protected boolean |
loadPlayerObject(Player player)
Verifies which instance the player can be loaded in to. |
java.util.List<java.lang.Object> |
matchingPlayers(Player player,
java.lang.String playerName,
java.lang.Boolean exactMatch)
|
void |
onActivate()
onActivate() is the real startup method. |
protected void |
processAbilityStatusEvent(ClientConnection con,
AbilityStatusEvent event)
|
protected void |
processActivateItem(ClientConnection con,
ActivateItemEvent event)
|
protected void |
processAutoAttack(ClientConnection con,
AutoAttackEvent event)
|
protected void |
processCom(ClientConnection con,
ComEvent event)
Process a ComEvent from the client, represent a chat event; calls the WorldManagerClient.sendaChatMsg to get the work done. |
protected void |
processCommand(ClientConnection con,
CommandEvent event)
Process a CommandEvent, representing a /foo command typed by a client; looks up the command in the commandMap, and runs the parser found there against the event, creating a Message instance, and broadcasts the Message. |
protected void |
processConnectionResetInternal(atavism.server.plugins.ProxyPlugin.ConnectionResetMessage message)
The method called by the event SquareQueue to reset the connection for a player. |
protected void |
processDirLocOrient(ClientConnection con,
DirLocOrientEvent event)
Process a DirLocOrientEvent from the client; calls the WorldManagerClient.updateWorldNode to get the work done. |
protected void |
processExtensionMessageEvent(ClientConnection con,
ExtensionMessageEvent event)
|
protected boolean |
processLogin(ClientConnection con,
AuthorizedLoginEvent loginEvent)
Process login message from the client. |
protected boolean |
processLoginHelper(ClientConnection con,
Player player)
This is a helper method that implements the part of login. |
protected void |
processLogout(ClientConnection con,
LogoutEvent event)
|
void |
processPacket(ClientConnection con,
AOByteBuffer buf)
The proxy method called to process a message from a client. |
protected void |
processPlayerIgnoreList(Player player)
Get the ignored oids property and if it is null, create it and set the player's property, and update the player. message. |
void |
processQuestResponse(ClientConnection con,
QuestResponse event)
Player is accepting or declining a quest |
void |
processReqConcludeQuest(ClientConnection con,
ConcludeQuest event)
Player is attempting to conclude a quest with a mob |
void |
processRequestQuestInfo(ClientConnection con,
RequestQuestInfo event)
Player is asking for info about a quest |
protected void |
processSceneLoaded(ClientConnection con,
SceneLoadedEvent event)
|
protected void |
pushInstanceRestorePoint(Player player,
BasicWorldNode loc)
|
protected void |
recreatePlayerSpecificCache()
|
void |
registerCommand(java.lang.String command,
ProxyPlugin.CommandParser parser)
Associates a CommandParser with the appropriate "slash" command. |
void |
registerCommand(java.lang.String command,
ProxyPlugin.CommandParser parser,
ProxyPlugin.CommandAccessCheck access)
Associates a CommandParser with the appropriate "slash" command. |
void |
registerExtensionSubtype(java.lang.String subtype,
MessageType type)
Register mapping from extension sub-type to server message type. |
static void |
removeStaticPerception(OID playerOid,
OID oid)
|
protected void |
sendOceanData(OceanData oceanData,
Player player)
|
protected void |
sendPlayerIgnoreList(Player player)
Get the ignored oids from the player object, then get the corresponding names and send both to the client in a property message. |
void |
setDevMode(boolean mode)
Set proxy development mode. |
void |
setExtraPlayerMessageTypes(java.util.List<MessageType> extraPlayerMessageTypes)
Set message types to add to proxy's player subscription filter. |
void |
setInstanceEntryCallback(InstanceEntryCallback callback)
Set the instance entry callback. |
void |
setProxyLoginCallback(ProxyLoginCallback callback)
Set the login callback. |
protected boolean |
specialCaseFreeProcessing(PerceptionMessage.ObjectNote objectNote,
Player player)
Check to see if freeing of this object is one of the special cases of object freeing: freeing a road, or a terrain decal. |
protected boolean |
specialCaseNewProcessing(PerceptionMessage.ObjectNote objectNote,
Player player)
Check to see if making this new object is one of the special cases of object creation: making a light, or a terrain decal, or a point sound. |
MessageType |
unregisterExtensionSubtype(java.lang.String subtype)
Unregister extension sub-type mapping. |
void |
updateIgnoredOids(Player player,
java.util.List<OID> nowIgnored,
java.util.List<OID> noLongerIgnored)
|
protected Player |
verifyPlayer(java.lang.String context,
Event event,
ClientConnection con)
If the ClientConnection associated with the playerOid passed in does not match the ClientConnection argument, throw an error. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface atavism.msgsys.MessageCallback |
---|
handleMessage |
Field Detail |
---|
public static final int PERCEPTION_GAIN_THRESHOLD
protected java.util.concurrent.locks.Lock commandMapLock
public boolean defaultAllowClientToClientMessage
allowClientToClientMessage()
when there is no method over-ride.
protected java.util.HashMap<java.lang.String,MessageType> extensionMessageRegistry
protected PerceptionFilter perceptionFilter
protected long perceptionSubId
protected PerceptionFilter responderFilter
protected long responderSubId
protected RDPServerSocket serverSocket
protected int clientPort
protected static final Logger log
protected PlayerManager playerManager
protected TimeHistogram proxyQueueHistogram
protected TimeHistogram proxyCallbackHistogram
protected java.util.List<MessageType> extraPlayerMessageTypes
public static final MessageType MSG_TYPE_VOICE_PARMS
public static final MessageType MSG_TYPE_PLAYER_PATH_REQ
public static final MessageType MSG_TYPE_UPDATE_PLAYER_IGNORE_LIST
public static final MessageType MSG_TYPE_GET_MATCHING_PLAYERS
public static final MessageType MSG_TYPE_PLAYER_IGNORE_LIST
public static final MessageType MSG_TYPE_PLAYER_IGNORE_LIST_REQ
public static final MessageType MSG_TYPE_RELAY_UPDATE_PLAYER_IGNORE_LIST
public static final MessageType MSG_TYPE_GET_PLAYER_LOGIN_STATUS
public static final MessageType MSG_TYPE_LOGOUT_PLAYER
public static final MessageType MSG_TYPE_ADD_STATIC_PERCEPTION
public static final MessageType MSG_TYPE_REMOVE_STATIC_PERCEPTION
public static final MessageType MSG_TYPE_LOGIN_SPAWNED
public static final MessageType MSG_TYPE_ACCOUNT_LOGIN
protected static java.lang.String voiceServerHost
protected static java.lang.Integer voiceServerPort
public java.lang.String serverCapabilitiesSentToClient
public static int MaxConcurrentUsers
public static int idleTimeout
public static int silenceTimeout
public static int silenceLoadingTimeout
public static int maxMessagesBeforeConnectionReset
public static int maxByteCountBeforeConnectionReset
public java.lang.String capacityError
public java.lang.String tokenError
protected java.util.Map<java.lang.String,java.util.List<ProxyExtensionHook>> extensionHooks
Constructor Detail |
---|
public ProxyPlugin()
onActivate()
Method Detail |
---|
public boolean isDevMode()
public void setDevMode(boolean mode)
ProxyPlugin.CommandAccessCheck
.
public java.util.List<MessageType> getExtraPlayerMessageTypes()
public void setExtraPlayerMessageTypes(java.util.List<MessageType> extraPlayerMessageTypes)
public void addExtraPlayerMessageType(MessageType messageType)
public void addExtraPlayerExtensionMessageType(MessageType messageType)
public void addProxyExtensionHook(java.lang.String subType, ProxyExtensionHook hook)
subType
- Extension message sub-type.hook
- Extension message handler.public java.util.Map<java.lang.String,java.util.List<ProxyExtensionHook>> getProxyExtensionHooks(java.lang.String subType)
public void onActivate()
onActivate
in class EnginePlugin
registerHooks()
,
ProxyPlugin.EventCallback.doWork(java.lang.Object, java.lang.Object)
public java.util.Map<java.lang.String,java.lang.String> getStatusMap()
EnginePlugin
getStatusMap
in interface StatusMapCallback
getStatusMap
in class EnginePlugin
public void registerCommand(java.lang.String command, ProxyPlugin.CommandParser parser)
command
- The command to associate with the CommandParse, eg: "/attack"parser
- Command handler.public void registerCommand(java.lang.String command, ProxyPlugin.CommandParser parser, ProxyPlugin.CommandAccessCheck access)
command
- The command to associate with the CommandParse, eg: "/attack"parser
- Command handler.access
- Command access checker.protected void initializeVoiceServerInformation()
public void acceptConnection(ClientConnection con)
acceptConnection
in interface ClientConnection.AcceptCallback
con
- The new client connection.public void processPacket(ClientConnection con, AOByteBuffer buf)
processPacket
in interface ClientConnection.MessageCallback
con
- The ClientConnection object for the player's client.buf
- The byte buffer containing message from the client.public java.util.Set<OID> getPlayerOids()
public java.util.List<java.lang.String> getPlayerNames()
public java.util.List<Player> getPlayers()
public Player getPlayer(OID oid)
public void addPlayerMessage(Message message, Player player)
public void addFilteredProperty(java.lang.String filteredProperty)
filteredProperty
- The string property name.public void addPlayerSpecificProperty(java.lang.String filteredProperty)
filteredProperty
- The string property name.protected void recreatePlayerSpecificCache()
protected boolean processLogin(ClientConnection con, AuthorizedLoginEvent loginEvent)
con
- The connection to the client.loginEvent
- The client message that asks to log the client in.protected boolean loadPlayerObject(Player player)
player
-
protected boolean processLoginHelper(ClientConnection con, Player player)
con
- The ClientConnection to the clientplayer
- The Player instance of the player that just logged inpublic ProxyLoginCallback getProxyLoginCallback()
public void setProxyLoginCallback(ProxyLoginCallback callback)
public InstanceEntryCallback getInstanceEntryCallback()
public void setInstanceEntryCallback(InstanceEntryCallback callback)
public void processRequestQuestInfo(ClientConnection con, RequestQuestInfo event)
public void processQuestResponse(ClientConnection con, QuestResponse event)
public void processReqConcludeQuest(ClientConnection con, ConcludeQuest event)
public void connectionReset(ClientConnection con)
connectionReset
in interface ClientConnection.MessageCallback
con
- The connection to the client.protected void processConnectionResetInternal(atavism.server.plugins.ProxyPlugin.ConnectionResetMessage message)
protected void processDirLocOrient(ClientConnection con, DirLocOrientEvent event)
protected void processCom(ClientConnection con, ComEvent event)
protected void processCommand(ClientConnection con, CommandEvent event)
protected void processAutoAttack(ClientConnection con, AutoAttackEvent event)
protected void processActivateItem(ClientConnection con, ActivateItemEvent event)
protected void processAbilityStatusEvent(ClientConnection con, AbilityStatusEvent event)
protected void processLogout(ClientConnection con, LogoutEvent event)
protected void processSceneLoaded(ClientConnection con, SceneLoadedEvent event)
protected void processExtensionMessageEvent(ClientConnection con, ExtensionMessageEvent event)
public void registerExtensionSubtype(java.lang.String subtype, MessageType type)
subtype
will be assigned
server message type type
.
public MessageType unregisterExtensionSubtype(java.lang.String subtype)
public MessageType getExtensionMessageType(java.lang.String subtype)
public boolean allowClientToClientMessage(Player sender, OID targetOid, WorldManagerClient.TargetedExtensionMessage message)
defaultAllowClientToClientMessage
.
Over-ride to implement security and filtering logic. The message
can be modified by this method; the modified message is sent to the
target client.
sender
- Sending player.targetOid
- Target player OID.message
- The extension message.
protected boolean specialCaseNewProcessing(PerceptionMessage.ObjectNote objectNote, Player player)
objectNote
- Describes the object to be created.player
- The player object to which the message should be sent.
protected boolean specialCaseFreeProcessing(PerceptionMessage.ObjectNote objectNote, Player player)
objectNote
- Describes the object to be created.player
- The player object to which the message should be sent.
protected void handleFreeRoad(ClientConnection con, OID objOid)
public static void addStaticPerception(OID playerOid, OID oid)
public static void addStaticPerception(OID oid, OID oid2, java.lang.String name, ObjectType type)
public static void removeStaticPerception(OID playerOid, OID oid)
protected void processPlayerIgnoreList(Player player)
player
- The player objectprotected void sendPlayerIgnoreList(Player player)
player
- The player objectpublic void updateIgnoredOids(Player player, java.util.List<OID> nowIgnored, java.util.List<OID> noLongerIgnored)
public java.util.List<java.lang.Object> matchingPlayers(Player player, java.lang.String playerName, java.lang.Boolean exactMatch)
public static OID handleFullInstance(int instanceTemplateID, InstanceClient.InstanceInfo instanceInfo)
instanceTemplateName
- instanceInfo
-
protected void pushInstanceRestorePoint(Player player, BasicWorldNode loc)
protected void sendOceanData(OceanData oceanData, Player player)
protected Player verifyPlayer(java.lang.String context, Event event, ClientConnection con)
public void incrementChatCount()
public void incrementPrivateChatCount()
public void addAdmin(OID oid)
public java.util.Set<OID> getAdmins()
public boolean isAdmin(OID playerOid)
protected java.lang.Object createMBeanInstance()
createMBeanInstance
in class EnginePlugin
|
Copyright © 2018 Dragonsan Studios Sp. z o.o. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |