Atavism Version 2018.1AGIS API

atavism.server.plugins
Class ProxyPlugin

java.lang.Object
  extended by atavism.server.engine.EnginePlugin
      extended by atavism.server.plugins.ProxyPlugin
All Implemented Interfaces:
MessageCallback, StatusMapCallback, ClientConnection.AcceptCallback, ClientConnection.MessageCallback
Direct Known Subclasses:
AgisProxyPlugin

public class ProxyPlugin
extends EnginePlugin
implements MessageCallback, ClientConnection.AcceptCallback, ClientConnection.MessageCallback

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.

See Also:
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
           
 
Nested classes/interfaces inherited from class atavism.server.engine.EnginePlugin
EnginePlugin.DeleteHook, EnginePlugin.DeleteSubObjHook, EnginePlugin.GenerateSubObjectHook, EnginePlugin.GetPropertyMessage, EnginePlugin.GetPropertyNamesMessage, EnginePlugin.LoadHook, EnginePlugin.LoadSubObjHook, EnginePlugin.PluginActivateHook, EnginePlugin.PluginStateMessage, EnginePlugin.SaveHook, EnginePlugin.SaveSubObjHook, EnginePlugin.SetPropertyMessage, EnginePlugin.SubObjData, EnginePlugin.TransferFilter, EnginePlugin.TransferObjectMessage, EnginePlugin.UnloadHook, EnginePlugin.UnloadSubObjHook
 
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 class atavism.server.engine.EnginePlugin
deleteSubObjectSubscription, dumpAllThreadSubscription, dumpAllThreadSubscriptionLock, loadSubObjectSubscription, lock, MSG_TYPE_DUMP_ALL_THREAD_STACKS, MSG_TYPE_GET_PROPERTY, MSG_TYPE_GET_PROPERTY_NAMES, MSG_TYPE_PLUGIN_STATE, MSG_TYPE_SET_PROPERTY, MSG_TYPE_SET_PROPERTY_NONBLOCK, MSG_TYPE_TRANSFER_OBJECT, pluginStateSubscription, propertySubscription, saveSubObjectSubscription, selectionFilter, selectionSubscription, setSubObjectPersistenceSubscription, subObjectSubscription, unloadSubObjectSubscription
 
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 atavism.server.engine.EnginePlugin
activate, createSubscription, getHookManager, getMessageHandler, getName, getObjectLockManager, getObjectProperties, getObjectProperties, getObjectProperty, getObjectPropertyNames, getPercentCPULoad, getPluginAvailable, getPluginInfo, getPluginNamespaces, getPluginState, getPluginStatus, getPluginType, getPropertyImpl, getPropertyNamesImpl, handleMessage, handleMessageImpl, logDepsOutstanding, processKeysAndValues, registerActivateHook, registerDeleteHook, registerLoadHook, registerPluginNamespace, registerPluginNamespaces, registerPluginNamespaces, registerPluginNamespaces, registerSaveHook, registerTransferHook, registerUnloadHook, sendSubObjectResponse, sendSubObjectResponse, sendSubObjectResponse, setMessageHandler, setName, setObjectProperties, setObjectProperties, setObjectProperties, setObjectPropertiesNoResponse, setObjectPropertiesNoResponse, setObjectPropertiesNoResponse, setObjectProperty, setObjectPropertyNoResponse, setPercentCPULoad, setPluginAvailable, setPluginInfo, setPluginType, setPropertyImpl, transferObject
 
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

PERCEPTION_GAIN_THRESHOLD

public static final int PERCEPTION_GAIN_THRESHOLD
See Also:
Constant Field Values

commandMapLock

protected java.util.concurrent.locks.Lock commandMapLock

defaultAllowClientToClientMessage

public boolean defaultAllowClientToClientMessage
Default value of allowClientToClientMessage() when there is no method over-ride.


extensionMessageRegistry

protected java.util.HashMap<java.lang.String,MessageType> extensionMessageRegistry

perceptionFilter

protected PerceptionFilter perceptionFilter

perceptionSubId

protected long perceptionSubId

responderFilter

protected PerceptionFilter responderFilter

responderSubId

protected long responderSubId

serverSocket

protected RDPServerSocket serverSocket

clientPort

protected int clientPort

log

protected static final Logger log

playerManager

protected PlayerManager playerManager

proxyQueueHistogram

protected TimeHistogram proxyQueueHistogram

proxyCallbackHistogram

protected TimeHistogram proxyCallbackHistogram

extraPlayerMessageTypes

protected java.util.List<MessageType> extraPlayerMessageTypes

MSG_TYPE_VOICE_PARMS

public static final MessageType MSG_TYPE_VOICE_PARMS

MSG_TYPE_PLAYER_PATH_REQ

public static final MessageType MSG_TYPE_PLAYER_PATH_REQ

MSG_TYPE_UPDATE_PLAYER_IGNORE_LIST

public static final MessageType MSG_TYPE_UPDATE_PLAYER_IGNORE_LIST

MSG_TYPE_GET_MATCHING_PLAYERS

public static final MessageType MSG_TYPE_GET_MATCHING_PLAYERS

MSG_TYPE_PLAYER_IGNORE_LIST

public static final MessageType MSG_TYPE_PLAYER_IGNORE_LIST

MSG_TYPE_PLAYER_IGNORE_LIST_REQ

public static final MessageType MSG_TYPE_PLAYER_IGNORE_LIST_REQ

MSG_TYPE_RELAY_UPDATE_PLAYER_IGNORE_LIST

public static final MessageType MSG_TYPE_RELAY_UPDATE_PLAYER_IGNORE_LIST

MSG_TYPE_GET_PLAYER_LOGIN_STATUS

public static final MessageType MSG_TYPE_GET_PLAYER_LOGIN_STATUS

MSG_TYPE_LOGOUT_PLAYER

public static final MessageType MSG_TYPE_LOGOUT_PLAYER

MSG_TYPE_ADD_STATIC_PERCEPTION

public static final MessageType MSG_TYPE_ADD_STATIC_PERCEPTION

MSG_TYPE_REMOVE_STATIC_PERCEPTION

public static final MessageType MSG_TYPE_REMOVE_STATIC_PERCEPTION

MSG_TYPE_LOGIN_SPAWNED

public static final MessageType MSG_TYPE_LOGIN_SPAWNED

MSG_TYPE_ACCOUNT_LOGIN

public static final MessageType MSG_TYPE_ACCOUNT_LOGIN

voiceServerHost

protected static java.lang.String voiceServerHost
For now, just one voice plugin. In the future, the proxy will maintain load information for each voice plugin process, and use that load information to decide which process to direct the user to.


voiceServerPort

protected static java.lang.Integer voiceServerPort

serverCapabilitiesSentToClient

public 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. This complements the client capabilities sent to the server in the version field of the initial LoginEvent.


MaxConcurrentUsers

public static int MaxConcurrentUsers
The number of concurrent users allowed in the game. login will fail if there are this many users online.


idleTimeout

public static int idleTimeout
Player idle timeout in seconds. If there has been no activity from the client, excluding heartbeats then the connection is closed.


silenceTimeout

public static int silenceTimeout
Player silence timeout in seconds. If there has been no contact from the client, including heartbeats then the connection is closed. ANDREW - changed to 30 seconds, so if a player closes their client, they are still in game for 30 seconds


silenceLoadingTimeout

public static int silenceLoadingTimeout
Player silence timeout in seconds while they are loading a scene. If there has been no contact from the client, including heartbeats then the connection is closed.


maxMessagesBeforeConnectionReset

public static int maxMessagesBeforeConnectionReset
If the client connection has more than this number of messages queued, reset the client connection


maxByteCountBeforeConnectionReset

public static int maxByteCountBeforeConnectionReset
If the client connection has more than this number of message bytes queued, reset the client connection


capacityError

public java.lang.String capacityError
The error message issued if too many clients try to log in.


tokenError

public java.lang.String tokenError
The error message issued if there's a secure token error.


extensionHooks

protected java.util.Map<java.lang.String,java.util.List<ProxyExtensionHook>> extensionHooks
Constructor Detail

ProxyPlugin

public 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. All the real startup action happens in the onActivate method.

See Also:
onActivate()
Method Detail

isDevMode

public boolean isDevMode()
True if the proxy is running in development mode.


setDevMode

public void setDevMode(boolean mode)
Set proxy development mode. Proxy 'slash' commands may use development mode to determine command access. See ProxyPlugin.CommandAccessCheck.


getExtraPlayerMessageTypes

public java.util.List<MessageType> getExtraPlayerMessageTypes()

setExtraPlayerMessageTypes

public void setExtraPlayerMessageTypes(java.util.List<MessageType> extraPlayerMessageTypes)
Set message types to add to proxy's player subscription filter. Must be called before the plugin is registered/activated. Useful to make the proxy subscribe to additional ExtensionMessage message types. You still need to add a Hook to handle the additional message types.


addExtraPlayerMessageType

public void addExtraPlayerMessageType(MessageType messageType)
Additional message type to add to proxy's player subscription filter. Must be called before the plugin is registered/activated. Useful to make the proxy subscribe to additional ExtensionMessage message types. You still need to add a Hook to handle the message type.


addExtraPlayerExtensionMessageType

public void addExtraPlayerExtensionMessageType(MessageType messageType)
Additional extension message type to add to proxy's player subscription filter. Must be called before the plugin is registered/activated. Message type will be handled with by the ProxyPlugin default ExtensionMessage handler.


addProxyExtensionHook

public void addProxyExtensionHook(java.lang.String subType,
                                  ProxyExtensionHook hook)
Call hook when client sends extension message sub-type. Multiple hooks can be registered for the same extension message sub-type. The order of invocation is undefined.

Parameters:
subType - Extension message sub-type.
hook - Extension message handler.

getProxyExtensionHooks

public java.util.Map<java.lang.String,java.util.List<ProxyExtensionHook>> getProxyExtensionHooks(java.lang.String subType)

onActivate

public void onActivate()
onActivate() is the real startup method. It:
  • Initializes the PacketAggregator, which groups together messages to the client if they are created in a short interval, defaulting to 25ms.
  • Initilizes display of message processing time histograms.
  • Enumerates the list of properties in PropertyMessages that don't need to be sent to the client, because the client doesn't pay attention to them. This is not yet customizable, but should be.
  • Calls registerHooks to enumerate the proxy's message processing hooks.
  • Establishes the PerceptionFilter for the many message types sent by other plugins, to which players and other objects will be added as the are created, and creates the master subscription using the PerceptionFilter. This is not yet customizable, but should be.
  • Creates and opens the RDP listener using the proxy listener port.
  • Creates and opens the TCP listener using the proxy listern port.
  • Overrides:
    onActivate in class EnginePlugin
    See Also:
    registerHooks(), ProxyPlugin.EventCallback.doWork(java.lang.Object, java.lang.Object)

    getStatusMap

    public java.util.Map<java.lang.String,java.lang.String> getStatusMap()
    Description copied from class: EnginePlugin
    Override to provide plugin status.

    Specified by:
    getStatusMap in interface StatusMapCallback
    Overrides:
    getStatusMap in class EnginePlugin

    registerCommand

    public void registerCommand(java.lang.String command,
                                ProxyPlugin.CommandParser parser)
    Associates a CommandParser with the appropriate "slash" command.

    Parameters:
    command - The command to associate with the CommandParse, eg: "/attack"
    parser - Command handler.

    registerCommand

    public void registerCommand(java.lang.String command,
                                ProxyPlugin.CommandParser parser,
                                ProxyPlugin.CommandAccessCheck access)
    Associates a CommandParser with the appropriate "slash" command.

    Parameters:
    command - The command to associate with the CommandParse, eg: "/attack"
    parser - Command handler.
    access - Command access checker.

    initializeVoiceServerInformation

    protected void initializeVoiceServerInformation()

    acceptConnection

    public void acceptConnection(ClientConnection con)
    Registers the proxy plugin instance as the message handler for the client connection.

    Specified by:
    acceptConnection in interface ClientConnection.AcceptCallback
    Parameters:
    con - The new client connection.

    processPacket

    public void processPacket(ClientConnection con,
                              AOByteBuffer buf)
    The proxy method called to process a message from a client.

    Specified by:
    processPacket in interface ClientConnection.MessageCallback
    Parameters:
    con - The ClientConnection object for the player's client.
    buf - The byte buffer containing message from the client.

    getPlayerOids

    public java.util.Set<OID> getPlayerOids()
    Used by the /dirlight command to get the set of player oids.

    Returns:
    The set of oids for logged-in players.

    getPlayerNames

    public java.util.List<java.lang.String> getPlayerNames()
    Used by the /who command to get the set of player names.

    Returns:
    The list of names for logged-in players.

    getPlayers

    public java.util.List<Player> getPlayers()
    Get the players using this proxy. The Player object is local to the proxy and only tracks the player's login status.


    getPlayer

    public Player getPlayer(OID oid)
    Get player. The Player object is local to the proxy and only tracks the player's login status.

    Returns:
    Player on success, null on failure.

    addPlayerMessage

    public void addPlayerMessage(Message message,
                                 Player player)
    Add message directly to player's message queue.


    addFilteredProperty

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

    Parameters:
    filteredProperty - The string property name.

    addPlayerSpecificProperty

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

    Parameters:
    filteredProperty - The string property name.

    recreatePlayerSpecificCache

    protected void recreatePlayerSpecificCache()

    processLogin

    protected boolean processLogin(ClientConnection con,
                                   AuthorizedLoginEvent loginEvent)
    Process login message from the client. The heavy lifting is done in the processLoginHelper method, and then we ask the playerManager to make a Player object for the connection.

    Parameters:
    con - The connection to the client.
    loginEvent - The client message that asks to log the client in.

    loadPlayerObject

    protected boolean loadPlayerObject(Player player)
    Verifies which instance the player can be loaded in to. Returns false if the player cannot be loaded. into an instance.

    Parameters:
    player -
    Returns:

    processLoginHelper

    protected boolean processLoginHelper(ClientConnection con,
                                         Player player)
    This is a helper method that implements the part of login. Mostly, it sends the client additional messages here, and set up the subscriptions that we will need.

    Parameters:
    con - The ClientConnection to the client
    player - The Player instance of the player that just logged in

    getProxyLoginCallback

    public ProxyLoginCallback getProxyLoginCallback()
    Get the login callback.


    setProxyLoginCallback

    public void setProxyLoginCallback(ProxyLoginCallback callback)
    Set the login callback. Methods on this object are called during player login.


    getInstanceEntryCallback

    public InstanceEntryCallback getInstanceEntryCallback()
    Get the instance entry callback.


    setInstanceEntryCallback

    public void setInstanceEntryCallback(InstanceEntryCallback callback)
    Set the instance entry callback. Methods on this object are called during player instancing.


    processRequestQuestInfo

    public void processRequestQuestInfo(ClientConnection con,
                                        RequestQuestInfo event)
    Player is asking for info about a quest


    processQuestResponse

    public void processQuestResponse(ClientConnection con,
                                     QuestResponse event)
    Player is accepting or declining a quest


    processReqConcludeQuest

    public void processReqConcludeQuest(ClientConnection con,
                                        ConcludeQuest event)
    Player is attempting to conclude a quest with a mob


    connectionReset

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

    Specified by:
    connectionReset in interface ClientConnection.MessageCallback
    Parameters:
    con - The connection to the client.

    processConnectionResetInternal

    protected void processConnectionResetInternal(atavism.server.plugins.ProxyPlugin.ConnectionResetMessage message)
    The method called by the event SquareQueue to reset the connection for a player. The player oid is in the event object.


    processDirLocOrient

    protected void processDirLocOrient(ClientConnection con,
                                       DirLocOrientEvent event)
    Process a DirLocOrientEvent from the client; calls the WorldManagerClient.updateWorldNode to get the work done.


    processCom

    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.


    processCommand

    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.


    processAutoAttack

    protected void processAutoAttack(ClientConnection con,
                                     AutoAttackEvent event)

    processActivateItem

    protected void processActivateItem(ClientConnection con,
                                       ActivateItemEvent event)

    processAbilityStatusEvent

    protected void processAbilityStatusEvent(ClientConnection con,
                                             AbilityStatusEvent event)

    processLogout

    protected void processLogout(ClientConnection con,
                                 LogoutEvent event)

    processSceneLoaded

    protected void processSceneLoaded(ClientConnection con,
                                      SceneLoadedEvent event)

    processExtensionMessageEvent

    protected void processExtensionMessageEvent(ClientConnection con,
                                                ExtensionMessageEvent event)

    registerExtensionSubtype

    public void registerExtensionSubtype(java.lang.String subtype,
                                         MessageType type)
    Register mapping from extension sub-type to server message type. Client-originated extension message with subtype will be assigned server message type type.


    unregisterExtensionSubtype

    public MessageType unregisterExtensionSubtype(java.lang.String subtype)
    Unregister extension sub-type mapping.


    getExtensionMessageType

    public MessageType getExtensionMessageType(java.lang.String subtype)
    Get server message type for an extension message sub-type.


    allowClientToClientMessage

    public boolean allowClientToClientMessage(Player sender,
                                              OID targetOid,
                                              WorldManagerClient.TargetedExtensionMessage message)
    Return true if the message is allowed from sending to target player. By default, returns the value of 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.

    Parameters:
    sender - Sending player.
    targetOid - Target player OID.
    message - The extension message.
    Returns:
    False if the message should not be sent to target player.

    specialCaseNewProcessing

    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. If so, do the processing here. If not, get the object info for the object, and send it to the client.

    Parameters:
    objectNote - Describes the object to be created.
    player - The player object to which the message should be sent.
    Returns:
    True if special-case handling took place, false otherwise.

    specialCaseFreeProcessing

    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. If so, do the processing here.

    Parameters:
    objectNote - Describes the object to be created.
    player - The player object to which the message should be sent.
    Returns:
    True if special-case handling took place, false otherwise.

    handleFreeRoad

    protected void handleFreeRoad(ClientConnection con,
                                  OID objOid)
    Tell the client to free the road represented by the objOid.


    addStaticPerception

    public static void addStaticPerception(OID playerOid,
                                           OID oid)

    addStaticPerception

    public static void addStaticPerception(OID oid,
                                           OID oid2,
                                           java.lang.String name,
                                           ObjectType type)

    removeStaticPerception

    public static void removeStaticPerception(OID playerOid,
                                              OID oid)

    processPlayerIgnoreList

    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.

    Parameters:
    player - The player object

    sendPlayerIgnoreList

    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.

    Parameters:
    player - The player object

    updateIgnoredOids

    public void updateIgnoredOids(Player player,
                                  java.util.List<OID> nowIgnored,
                                  java.util.List<OID> noLongerIgnored)

    matchingPlayers

    public java.util.List<java.lang.Object> matchingPlayers(Player player,
                                                            java.lang.String playerName,
                                                            java.lang.Boolean exactMatch)

    handleFullInstance

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

    Parameters:
    instanceTemplateName -
    instanceInfo -
    Returns:

    pushInstanceRestorePoint

    protected void pushInstanceRestorePoint(Player player,
                                            BasicWorldNode loc)

    sendOceanData

    protected void sendOceanData(OceanData oceanData,
                                 Player player)

    verifyPlayer

    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.


    incrementChatCount

    public void incrementChatCount()

    incrementPrivateChatCount

    public void incrementPrivateChatCount()

    addAdmin

    public void addAdmin(OID oid)
    Adds an oid to the list of players which are allowed to log in even when the server reaches MaxConcurrentUsers


    getAdmins

    public java.util.Set<OID> getAdmins()
    Returns a set of admin oids


    isAdmin

    public boolean isAdmin(OID playerOid)
    Returns true if the oid is in the set of admins; false otherwise.


    createMBeanInstance

    protected java.lang.Object createMBeanInstance()
    Return JMX MBean instance object. Over-ride to provide your own MBean implementation.

    Overrides:
    createMBeanInstance in class EnginePlugin


    Copyright © 2018 Dragonsan Studios Sp. z o.o.