uk.org.redfelineninja.risk.net
Interface RiskServerInterface

All Known Implementing Classes:
RiskServerDebug, RiskServerHandler

public interface RiskServerInterface

All actions that can be performed on the server.


Method Summary
 void cards(Card[] cards)
          Exchange the supplied cards for armies.
 void closeConnection()
          Close the current connection.
 void countryClicked(java.lang.String country)
          Inform the server that a country has been clicked on.
 void finishTurn()
          Complete the current turn.
 void fortify()
          Change into fortify mode.
 boolean isConnected()
          Test whether or not we are connected to a server.
 void joinGame(java.lang.String gamename)
          Join an existing game of Risk
 void message(java.lang.String message)
          Send a message to all players.
 void message(java.lang.String message, Player player)
          Send a message to the named player.
 void newGame(java.lang.String gamename, boolean random, boolean privacy)
          Start a new game of risk with the supplied name
 void openConnection(java.lang.String hostname, int port, Player player)
          Open a connection to the server.
 void startGame()
          Start the game of risk.
 void stopGame(java.lang.String reason)
          Stop the current game of risk.
 

Method Detail

openConnection

public void openConnection(java.lang.String hostname,
                           int port,
                           Player player)
                    throws java.io.IOException
Open a connection to the server.

java.io.IOException

closeConnection

public void closeConnection()
                     throws java.io.IOException
Close the current connection. This will cause the player to leave the game and this is impolite. The server however is not in a position to enforce good manners.

java.io.IOException

isConnected

public boolean isConnected()
Test whether or not we are connected to a server.


newGame

public void newGame(java.lang.String gamename,
                    boolean random,
                    boolean privacy)
Start a new game of risk with the supplied name

Parameters:
random - start with randomly owned countries
privacy - permit private talking on the message system

joinGame

public void joinGame(java.lang.String gamename)
Join an existing game of Risk


startGame

public void startGame()
Start the game of risk. After as many players a desired have joined the game then call this method.


stopGame

public void stopGame(java.lang.String reason)
Stop the current game of risk. This should be considered impolite but at times may be unavaoidable. Only the person who started the game is permitted to stop it.

Parameters:
reason - the reason for the game being halted

message

public void message(java.lang.String message)
Send a message to all players.

Parameters:
message - the message

message

public void message(java.lang.String message,
                    Player player)
Send a message to the named player. This may be forbidden by the server in some games.

Parameters:
message - the message
player - the player to send the message to

countryClicked

public void countryClicked(java.lang.String country)
Inform the server that a country has been clicked on. Since text is used to identify countries, it is helpful if the server and client use the same set up files.

Parameters:
country - string giving the country that was clicked on.

cards

public void cards(Card[] cards)
Exchange the supplied cards for armies. Subject to checking by the server obviously.

Parameters:
cards - the card to be exchanged

fortify

public void fortify()
Change into fortify mode.


finishTurn

public void finishTurn()
Complete the current turn.