Class AddPlayerMessage


  • public class AddPlayerMessage
    extends ObjectMessage
    The message sent to add or update players to the game.
    • Field Detail

      • destination

        private final Player destination
        The player to specialize the players for.
    • Constructor Detail

      • AddPlayerMessage

        public AddPlayerMessage​(Player destination,
                                java.util.List<Player> players)
        Create a new AddPlayerMessage.
        Parameters:
        destination - An optional Player that will see this message.
        players - A list of Players to add.
      • AddPlayerMessage

        public AddPlayerMessage​(Game game,
                                FreeColXMLReader xr)
                         throws javax.xml.stream.XMLStreamException
        Create a new AddPlayerMessage from a stream.
        Parameters:
        game - The Game this message belongs to.
        xr - The FreeColXMLReader to read from.
        Throws:
        javax.xml.stream.XMLStreamException - if there is a problem reading the stream.
    • Method Detail

      • getPlayers

        private java.util.List<Player> getPlayers()
        Get the attached players.
        Returns:
        The list of Players to add.
      • toXML

        public void toXML​(FreeColXMLWriter xw)
                   throws javax.xml.stream.XMLStreamException
        Write this message as XML.
        Overrides:
        toXML in class Message
        Parameters:
        xw - The FreeColXMLWriter to write with.
        Throws:
        javax.xml.stream.XMLStreamException - if there is a problem writing the stream.
      • 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)
        Client-side handler for this message. Client handlers always return null.
        Overrides:
        clientHandler in class TrivialMessage
        Parameters:
        freeColClient - The FreeColClient to handle this message.