Class SetCurrentPlayerMessage


  • public class SetCurrentPlayerMessage
    extends AttributeMessage
    The message sent to the clients to signal a change of player.
    • Constructor Detail

      • SetCurrentPlayerMessage

        public SetCurrentPlayerMessage​(Player player)
        Create a new SetCurrentPlayerMessage with the given player.
        Parameters:
        player - The Player whose turn it is to be.
      • SetCurrentPlayerMessage

        public SetCurrentPlayerMessage​(Game game,
                                       FreeColXMLReader xr)
                                throws javax.xml.stream.XMLStreamException
        Create a new SetCurrentPlayerMessage from a stream.
        Parameters:
        game - The Game to read within.
        xr - The FreeColXMLReader to read from.
        Throws:
        javax.xml.stream.XMLStreamException - if the stream is corrupt.
    • Method Detail

      • aiHandler

        public void aiHandler​(FreeColServer freeColServer,
                              AIPlayer aiPlayer)
        AI-side handler for this message. AI handlers always return null. FIXME: One day the FreeColServer should devolve to AIMain.
        Overrides:
        aiHandler in class TrivialMessage
        Parameters:
        freeColServer - The FreeColServer handling the request.
        aiPlayer - The AIPlayer the message was sent to.
      • clientHandler

        public void clientHandler​(FreeColClient freeColClient)
                           throws FreeColException
        Client-side handler for this message. Client handlers always return null.
        Overrides:
        clientHandler in class TrivialMessage
        Parameters:
        freeColClient - The FreeColClient to handle this message.
        Throws:
        FreeColException - if there is a problem building the message.
      • getPlayer

        public Player getPlayer​(Game game)
        Who is the new player?
        Parameters:
        game - The Game to find the player in.
        Returns:
        The Player whose turn it now is.