Class ChooseFoundingFatherMessage


  • public class ChooseFoundingFatherMessage
    extends AttributeMessage
    The message sent to choose a founding father.
    • Field Detail

      • FOUNDING_FATHER_TAG

        private static final java.lang.String FOUNDING_FATHER_TAG
        See Also:
        Constant Field Values
      • fatherKeys

        private static final java.util.List<java.lang.String> fatherKeys
    • Constructor Detail

      • ChooseFoundingFatherMessage

        public ChooseFoundingFatherMessage​(java.util.List<FoundingFather> fathers,
                                           FoundingFather ff)
        Create a new ChooseFoundingFatherMessage with the specified fathers.
        Parameters:
        fathers - The FoundingFathers to choose from.
        ff - The FoundingFather to select.
      • ChooseFoundingFatherMessage

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

      • setFatherAttributes

        private void setFatherAttributes​(java.util.List<FoundingFather> fathers)
        Set the attributes arising from a list of founding fathers.
        Parameters:
        fathers - A list of FoundingFather.
      • getAttributeMap

        private static java.util.Map<java.lang.String,​java.lang.String> getAttributeMap​(FreeColXMLReader xr)
        Get a map of attributes from the reader.
        Parameters:
        xr - The FreeColXMLReader to query.
        Returns:
        A map of attributes.
      • currentPlayerMessage

        public boolean currentPlayerMessage()
        Should this message only be sent to a server by the current player?
        Overrides:
        currentPlayerMessage in class TrivialMessage
        Returns:
        True if this is a current-player-only message.
      • 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.
      • serverHandler

        public ChangeSet serverHandler​(FreeColServer freeColServer,
                                       ServerPlayer serverPlayer)
        Server-side handler for this message.
        Overrides:
        serverHandler in class TrivialMessage
        Parameters:
        freeColServer - The FreeColServer handling the request.
        serverPlayer - The ServerPlayer that sent the request.
        Returns:
        A ChangeSet defining the response.
      • getFather

        public final FoundingFather getFather​(Game game)
        Get the chosen father.
        Parameters:
        game - The Game to lookup the father in.
        Returns:
        The chosen FoundingFather, or null if none set.
      • getFathers

        public final java.util.List<FoundingFather> getFathers​(Game game)
        Get the list of offered fathers.
        Parameters:
        game - The FreeCol game being played.
        Returns:
        The offered FoundingFathers.