ggz.client.core
Class ServerAdapter

java.lang.Object
  extended by ggz.client.core.ServerAdapter
All Implemented Interfaces:
ServerListener, java.util.EventListener

public class ServerAdapter
extends java.lang.Object
implements ServerListener


Constructor Summary
ServerAdapter()
           
 
Method Summary
 void server_channel_connected()
          Status event: a requested direct game connection has been established.
 void server_channel_fail(java.lang.String error)
          Error: Failure during setup of direct connection to game server.
 void server_channel_ready()
          Game channel is ready for read/write operations.
 void server_chat_fail(ErrorEventData data)
          Error: A chat message could not be sent.
 void server_connect_fail(java.lang.String error)
          Error: we have failed to connect to the server.
 void server_connected()
          We have just made a connection to the server.
 void server_enter_fail(ErrorEventData data)
          Error: we have tried to enter a room and failed.
 void server_enter_ok()
          We have successfully entered a room.
 void server_list_rooms()
          The room list arrived.
 void server_list_types()
          The list of game types is available.
 void server_logged_out()
          Logged out of the server.
 void server_login_fail(ErrorEventData data)
          Error: login failure.
 void server_login_ok()
          We have successfully logged in.
 void server_motd_loaded(MotdEventData data)
          The MOTD has been read from the server and can be displayed.
 void server_negotiate_fail(java.lang.String error)
          Error: negotiation failure.
 void server_negotiated()
          We have negotiated a connection to the server.
 void server_net_error(java.lang.String error)
          Error: a network (transmission) error occurred.
 void server_players_changed()
          The number of players on the server has changed.
 void server_protocol_error(java.lang.String error)
          Error: a communication protocol error occured.
 void server_rooms_changed()
          A room has either been added, deleted or set to "closed".
 void server_state_changed()
          The internal state of ggzcore has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerAdapter

public ServerAdapter()
Method Detail

server_channel_connected

public void server_channel_connected()
Description copied from interface: ServerListener
Status event: a requested direct game connection has been established. To start a game (table), a channel must be created. This event will alert that the channel has been established. The channel's FD should then be monitored for input, which should then be passed back to the server object for handling.

Specified by:
server_channel_connected in interface ServerListener
See Also:
ggzcore_server_get_channel, ggzcore_server_read_data

server_channel_fail

public void server_channel_fail(java.lang.String error)
Description copied from interface: ServerListener
Error: Failure during setup of direct connection to game server. If the channel could not be prepared, this event will happen instead of GGZ_CHANNEL_READY or GGZ_CHANNEL_CONNECTED event. At this point the channel is no longer useful (I think).

Specified by:
server_channel_fail in interface ServerListener
See Also:
ggzcore_server_read_data

server_channel_ready

public void server_channel_ready()
Description copied from interface: ServerListener
Game channel is ready for read/write operations. After the channel has been connected, if we continue to monitor the socket eventually it will be negotiated and ready to use. At this point it is ready for the game client to use.

Specified by:
server_channel_ready in interface ServerListener
See Also:
ggzcore_server_read_data

server_chat_fail

public void server_chat_fail(ErrorEventData data)
Description copied from interface: ServerListener
Error: A chat message could not be sent. This will happen when we try to send a chat and the server rejects it.

Specified by:
server_chat_fail in interface ServerListener
Parameters:
data - A pointer to a GGZErrorEventData.
See Also:
GGZErrorEventData, ggzcore_server_read_data

server_connect_fail

public void server_connect_fail(java.lang.String error)
Description copied from interface: ServerListener
Error: we have failed to connect to the server. This is generated in place of GGZ_CONNECTED if the connection could not be made. The server object is otherwise unaffected.

Specified by:
server_connect_fail in interface ServerListener
See Also:
ggzcore_server_connect

server_connected

public void server_connected()
Description copied from interface: ServerListener
We have just made a connection to the server. After this point the server's socket should be accessible and should be monitored for data. It happens in direct response to ggzcore_server_connect. Note that most events after this will only happen by calling ggzcore_server_read_data on the server's FD!

Specified by:
server_connected in interface ServerListener
See Also:
ggzcore_server_connect

server_enter_fail

public void server_enter_fail(ErrorEventData data)
Description copied from interface: ServerListener
Error: we have tried to enter a room and failed. This will be issued to tell us a room join has failed.

Specified by:
server_enter_fail in interface ServerListener
Parameters:
data - A pointer to a GGZErrorEventData.
See Also:
GGZErrorEventData, ggzcore_server_join_room, ggzcore_server_read_data

server_enter_ok

public void server_enter_ok()
Description copied from interface: ServerListener
We have successfully entered a room. This will be issued to tell us a room join has succeeded, after it has been requested.

Specified by:
server_enter_ok in interface ServerListener
See Also:
ggzcore_server_join_room, ggzcore_server_read_data

server_list_rooms

public void server_list_rooms()
Description copied from interface: ServerListener
The room list arrived. This will only happen after the list is requested by ggzcore_server_list_rooms(). The list may be accessed through ggzcore_server_get_num_rooms() and ggzcore_server_get_nth_room(). Until this event arrives these functions will be useless!

Specified by:
server_list_rooms in interface ServerListener
See Also:
ggzcore_server_read_data

server_list_types

public void server_list_types()
Description copied from interface: ServerListener
The list of game types is available. This will only happen after the list is requested by ggzcore_server_list_types(). The list may be accessed through ggzcore_server_get_num_gametypes() and ggzcore_server_get_nth_gametype(). Until this event arrives these functions will be useless!

Specified by:
server_list_types in interface ServerListener
See Also:
ggzcore_server_read_data

server_logged_out

public void server_logged_out()
Description copied from interface: ServerListener
Logged out of the server. This will happen when the server completes the communication; usually after ggzcore_net_send_logout is called.

Specified by:
server_logged_out in interface ServerListener
See Also:
ggzcore_server_read_data

server_login_fail

public void server_login_fail(ErrorEventData data)
Description copied from interface: ServerListener
Error: login failure. This will happen in place of GGZ_LOGGED_IN if the login failed. The server object will be otherwise unaffected.

Specified by:
server_login_fail in interface ServerListener
Parameters:
data - A pointer to a GGZErrorEventData.
See Also:
GGZErrorEventData, ggzcore_server_read_data

server_login_ok

public void server_login_ok()
Description copied from interface: ServerListener
We have successfully logged in. We can now start doing stuff. This will not happen until the client sends their login information.

Specified by:
server_login_ok in interface ServerListener
See Also:
ggzcore_server_login, ggzcore_server_read_data

server_motd_loaded

public void server_motd_loaded(MotdEventData data)
Description copied from interface: ServerListener
The MOTD has been read from the server and can be displayed. The server will send us the MOTD automatically after login; it can also be requested by ggzcore_server_motd. It is up to the client whether or not to display it. See the online documentation (somewhere?) about the MOTD markup format.

Specified by:
server_motd_loaded in interface ServerListener
Parameters:
data - Pointer to a GGZMotdEventData including the full MOTD text.
See Also:
ggzcore_server_motd, ggzcore_server_read_data!

server_negotiate_fail

public void server_negotiate_fail(java.lang.String error)
Description copied from interface: ServerListener
Error: negotiation failure. Could be the wrong version. This will happen in place of a GGZ_NEGOTIATED if the server could not be negotiated with.

Specified by:
server_negotiate_fail in interface ServerListener
See Also:
ggzcore_server_read_data

server_negotiated

public void server_negotiated()
Description copied from interface: ServerListener
We have negotiated a connection to the server. This will happen automatically once a connection has been established, if the server socket is monitored.

Specified by:
server_negotiated in interface ServerListener
See Also:
ggzcore_server_read_data

server_net_error

public void server_net_error(java.lang.String error)
Description copied from interface: ServerListener
Error: a network (transmission) error occurred. The server will automatically disconnect.

Specified by:
server_net_error in interface ServerListener
See Also:
ggzcore_server_read_data

server_players_changed

public void server_players_changed()
Description copied from interface: ServerListener
The number of players on the server has changed. This event is issued rather frequently every time players enter or leave.

Specified by:
server_players_changed in interface ServerListener
See Also:
ggzcore_server_get_num_players, ggzcore_server_read_data

server_rooms_changed

public void server_rooms_changed()
Description copied from interface: ServerListener
A room has either been added, deleted or set to "closed".

Specified by:
server_rooms_changed in interface ServerListener

server_protocol_error

public void server_protocol_error(java.lang.String error)
Description copied from interface: ServerListener
Error: a communication protocol error occured. This can happen in a variety of situations when the server sends us something we can't handle. The server will be automatically disconnected.

Specified by:
server_protocol_error in interface ServerListener
See Also:
ggzcore_server_read_data

server_state_changed

public void server_state_changed()
Description copied from interface: ServerListener
The internal state of ggzcore has changed. This may happen at any time.

Specified by:
server_state_changed in interface ServerListener
See Also:
GGZStateID, ggzcore_server_get_state