Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## it.gotoandplay.smartfoxserver.events
Class InternalEventObject

    java.lang.Object
      it.gotoandplay.smartfoxserver.events.InternalEventObject

    public class InternalEventObject

extends java.lang.Object

The InternalEventObject describes the type of event dispatched by the Server and contains the parameters passed by the Server.

Here's a list of the internal events dispatched by the Server and the parameters passed:

loginRequest

- zone (String)
- nick (String)
- pass (String)
- chan (SocketChannel)

userJoin

- zone (String)
- user (User)
- room (Room)

userExit

- zone (String)
- room (Room)
- uid (String)
- oldPlayerIndex (String)
- user (User) - since 1.5.9

userLost

- zone (String)
- roomIds (int[])
- uid (String)
- playerIndexes (int[])
- user (User) - since 1.5.9

logOut

- zone (String)
- roomIds (int[])
- chan (SocketChannel)
- uid (String)
- playerIndexes (int[])
- user (User) - since 1.6.2

newRoom

- room (Room)

roomLost

- zone (String)
- roomId (String)

spectatorSwitched

- user (User)
- playerIndex (String)
- room (Room) - since 1.6.9

playerSwitched

- user (User)
- room (Room) - since 1.6.9

pubMsg

- msg (String)
- user (User)
- room (Room)

NOTE: This event is not fired by default. You can turn it on by calling:

    zone.setPubMsgInternalEvent(true)

in the extension init() method.

privMsg

- msg (String)
- room (Room)
- sender (User)
- recipient (User)

NOTE: This event is not fired by default. You can turn it on by calling:

    zone.setPrivMsgInternalEvent(true)

in the extension init() method.

fileUpload

- user (User)
- files (HashMap) - key = filename on server, value = original filename

serverReady
This event is fired when the server engine has finished booting and it's ready to accept connections. The event can be used to initialize NPCs.

### Usage Examples:

     public class ExampleExtension extends AbstractExtension
     {
            private ExtensionHelper helper;

            public void init()
            {
                    helper = ExtensionHelper.instance();
            }

            public void handleInternalEvent(InternalEventObject evt)
            {
                    String evtName = evt.getEventName();

                    if (evtName.equals("loginRequest"))
                    {
                            String nick = ieo.getParam("nick");
                            String pass = ieo.getParam("pass");
                            SocketChannel chan = (SocketChannel) ieo.getObject("chan");

                            if (nick.equals("test") && pass.equals("test"))
                            {
                                    helper.trace("Nick and password correct!", this);
                            }
                            else
                            {
                                    helper.trace("Wrong name or password", this);
                            }

                    }
            }

     }

Author:
  Marco Lapi
  (c) 2005 gotoAndPlay() -- www.gotoandplay.it

Field Summary
`static java.lang.String` | `EVENT_FILE_UPLOAD`
`static java.lang.String` | `EVENT_JOIN`
`static java.lang.String` | `EVENT_LOGIN`
`static java.lang.String` | `EVENT_LOGOUT`
`static java.lang.String` | `EVENT_NEW_ROOM`
`static java.lang.String` | `EVENT_PLAYER_SWITCHED`
`static java.lang.String` | `EVENT_PRIVATE_MESSAGE`
`static java.lang.String` | `EVENT_PUBLIC_MESSAGE`
`static java.lang.String` | `EVENT_ROOM_LOST`
`static java.lang.String` | `EVENT_SERVER_READY`
`static java.lang.String` | `EVENT_SPECTATOR_SWITCHED`
`static java.lang.String` | `EVENT_USER_EXIT`
`static java.lang.String` | `EVENT_USER_LOST`

Constructor Summary
`InternalEventObject(java.lang.String evtName)` Creates a new instance of EventObject

Method Summary
`void` | `addObject(java.lang.String key, java.lang.Object o)` Adds an object to the event
`void` | `addParam(java.lang.String key, java.lang.String value)`
`java.lang.String` | `getEventName()`
`java.lang.Object` | `getObject(java.lang.String key)`
`java.lang.String` | `getParam(java.lang.String key)`
`java.lang.Object[]` | `getTypedObject(java.lang.String key)`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EVENT_LOGIN

    public static final java.lang.String EVENT_LOGIN

See Also:
  Constant Field Values

### EVENT_LOGOUT

    public static final java.lang.String EVENT_LOGOUT

See Also:
  Constant Field Values

### EVENT_JOIN

    public static final java.lang.String EVENT_JOIN

See Also:
  Constant Field Values

### EVENT_USER_EXIT

    public static final java.lang.String EVENT_USER_EXIT

See Also:
  Constant Field Values

### EVENT_USER_LOST

    public static final java.lang.String EVENT_USER_LOST

See Also:
  Constant Field Values

### EVENT_SPECTATOR_SWITCHED

    public static final java.lang.String EVENT_SPECTATOR_SWITCHED

See Also:
  Constant Field Values

### EVENT_NEW_ROOM

    public static final java.lang.String EVENT_NEW_ROOM

See Also:
  Constant Field Values

### EVENT_ROOM_LOST

    public static final java.lang.String EVENT_ROOM_LOST

See Also:
  Constant Field Values

### EVENT_PUBLIC_MESSAGE

    public static final java.lang.String EVENT_PUBLIC_MESSAGE

See Also:
  Constant Field Values

### EVENT_PRIVATE_MESSAGE

    public static final java.lang.String EVENT_PRIVATE_MESSAGE

See Also:
  Constant Field Values

### EVENT_FILE_UPLOAD

    public static final java.lang.String EVENT_FILE_UPLOAD

See Also:
  Constant Field Values

### EVENT_SERVER_READY

    public static final java.lang.String EVENT_SERVER_READY

See Also:
  Constant Field Values

### EVENT_PLAYER_SWITCHED

    public static final java.lang.String EVENT_PLAYER_SWITCHED

See Also:
  Constant Field Values

Constructor Detail

### InternalEventObject

    public InternalEventObject(java.lang.String evtName)

  Creates a new instance of EventObject

Method Detail

### getEventName

    public java.lang.String getEventName()

  Returns:
    Returns the name of the event

### addParam

    public void addParam(java.lang.String key,
                         java.lang.String value)

  Parameters:
    `key` - Name of the parameter to attach to the event
    `value` - Value for the parameter. All values are represented through String objects.

### getParam

    public java.lang.String getParam(java.lang.String key)

  Parameters:
    `key` - the name of the parameter to get
  Returns:
    returns a String parameter

### addObject

    public void addObject(java.lang.String key,
                          java.lang.Object o)

  Adds an object to the event

  Parameters:
    `key` - the name of the parameter
    `o` - the object

### getObject

    public java.lang.Object getObject(java.lang.String key)

  Parameters:
    `key` - the name of the object to get
  Returns:
    get the object

### getTypedObject

    public java.lang.Object[] getTypedObject(java.lang.String key)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD