Interface IGameServer

All Superinterfaces:
Remote
All Known Implementing Classes:
RMIServer

public interface IGameServer extends Remote
Remote interface used by RMI clients to interact with the game server.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Notifies the server of a voluntary disconnection for the specified player.
    void
    drawLowerBuildingCard(String playerUsername, int pos)
    Requests to draw a building card from the lower building card list.
    void
    drawLowerTribeCard(String playerUsername, int pos)
    Requests to draw a tribe card from the lower tribe card list.
    void
    drawUpperBuildingCard(String playerUsername, int pos)
    Requests to draw a building card from the upper building card list.
    void
    drawUpperTribeCard(String playerUsername, int pos)
    Requests to draw a tribe card from the upper tribe card list.
    joinGame(String username, int preferredInt, IClientCallback callback)
    Adds a player to the game and registers the callback used by the server to notify the corresponding RMI client.
    void
    ping(String username)
    Heartbeat method called periodically by the client to signal that it is still connected.
    void
    skipTurn(String playerUsername)
    Requests to skip the current player's optional action.
    void
    slotChoice(String playerUsername, int pos)
    Requests to assign the specified player to a slot.
    void
    totemChoice(String playerUsername, String totems)
    Requests to assign the selected totem to the specified player.
  • Method Details

    • joinGame

      ErrorType joinGame(String username, int preferredInt, IClientCallback callback) throws RemoteException
      Adds a player to the game and registers the callback used by the server to notify the corresponding RMI client.
      Parameters:
      username - the username chosen by the player.
      preferredInt - the desired number of players proposed by this client.
      callback - the remote callback associated with the client.
      Returns:
      null if the player joins successfully; an ErrorType value describing the rejection otherwise.
      Throws:
      RemoteException - if an RMI communication error occurs.
    • drawUpperTribeCard

      void drawUpperTribeCard(String playerUsername, int pos) throws RemoteException
      Requests to draw a tribe card from the upper tribe card list.
      Parameters:
      playerUsername - the username of the player performing the action.
      pos - the position of the selected card.
      Throws:
      RemoteException - if an RMI communication error occurs.
    • drawLowerTribeCard

      void drawLowerTribeCard(String playerUsername, int pos) throws RemoteException
      Requests to draw a tribe card from the lower tribe card list.
      Parameters:
      playerUsername - the username of the player performing the action.
      pos - the position of the selected card.
      Throws:
      RemoteException - if an RMI communication error occurs.
    • drawUpperBuildingCard

      void drawUpperBuildingCard(String playerUsername, int pos) throws RemoteException
      Requests to draw a building card from the upper building card list.
      Parameters:
      playerUsername - the username of the player performing the action.
      pos - the position of the selected card.
      Throws:
      RemoteException - if an RMI communication error occurs.
    • drawLowerBuildingCard

      void drawLowerBuildingCard(String playerUsername, int pos) throws RemoteException
      Requests to draw a building card from the lower building card list.
      Parameters:
      playerUsername - the username of the player performing the action.
      pos - the position of the selected card.
      Throws:
      RemoteException - if an RMI communication error occurs.
    • skipTurn

      void skipTurn(String playerUsername) throws RemoteException
      Requests to skip the current player's optional action.
      Parameters:
      playerUsername - the username of the player skipping the action.
      Throws:
      RemoteException - if an RMI communication error occurs.
    • slotChoice

      void slotChoice(String playerUsername, int pos) throws RemoteException
      Requests to assign the specified player to a slot.
      Parameters:
      playerUsername - the username of the player making the slot choice.
      pos - the position of the selected slot.
      Throws:
      RemoteException - if an RMI communication error occurs.
    • totemChoice

      void totemChoice(String playerUsername, String totems) throws RemoteException
      Requests to assign the selected totem to the specified player.
      Parameters:
      playerUsername - the username of the player making the totem choice.
      totems - the name of the selected totem.
      Throws:
      RemoteException - if an RMI communication error occurs.
    • ping

      void ping(String username) throws RemoteException
      Heartbeat method called periodically by the client to signal that it is still connected.

      This method mirrors the PING/PONG mechanism used in the TCP heartbeat channel.

      Parameters:
      username - the username of the client sending the heartbeat ping.
      Throws:
      RemoteException - if an RMI communication error occurs.
    • disconnectPlayer

      void disconnectPlayer(String username) throws RemoteException
      Notifies the server of a voluntary disconnection for the specified player.
      Parameters:
      username - the username of the player disconnecting.
      Throws:
      RemoteException - if an RMI communication error occurs.