Server Event Handling
From Multiverse
| Multiverse Servers |
|
Installing • Installing on Linux • Running • Troubleshooting • FAQ • Release Notes • Updating • JMX Monitoring & Mgmt. |
| Infrastructure |
|
Platform Architecture • Registering a World • Proxy Server • Event Handling • World Manager • Voice Server |
| Messaging System |
|
Perception Messaging • Using Extension Messages • Message Marshalling • Multi-subject Messaging • Message Catalog |
| Object Architecture |
|
World Instancing • Server Object Search • Server Regions • Server Markers |
| Scalability and Performance |
| Reference |
|
File Layout • Property File • Logging • API |
The Multiverse proxy server maps incoming events from the Multiverse Client to server-based messages. A server event is represented by a Java class that extends multiverse.server.engine.Event and thus must implement the method:
abstract protected void parseBytes(MVByteBuffer buf);
Using this method, Event objects can parse Client message data in the form of a MVByteBuffer into an Event object.
The server defines event objects in two packages:
-
multiverse.server.eventsdefines general events such as DirLocEvent, LoginEvent, and NewObjectEvent. -
multiverse.mars.eventsdefines MARS-specific events such as CombatEvent, QuestAvailableEvent, and EquipEvent.
The script multiverse/config/common/events.py defines the mapping
between Client messages and server events. This script maps message IDs to the corresponding event class. For example, the line:
evtSvr.registerEventId(2, "multiverse.server.events.DirLocEvent")
specifies to call the DirLocEvent object when the proxy server receives a message with ID of 2. This message would be created by the client, for example, when a player moves. The proxy server then dispatches this message to other plugins.
events.py since the client uses the message ID numbers it defines.In a future release, you will be able to customize event handling.
In the meantime, send a Multiverse.Network.CommandMessage to the server and write a command
handler in the proxy to translate this message to a server message. For more information on command handlers, see Defining Command Handlers.
