Class IndianDemandMessage


  • public class IndianDemandMessage
    extends AttributeMessage
    The message sent to resolve natives making demands of a colony.
    • Constructor Detail

      • IndianDemandMessage

        public IndianDemandMessage​(Unit unit,
                                   Colony colony,
                                   GoodsType type,
                                   int amount)
        Create a new IndianDemandMessage with the supplied unit, colony and demands.
        Parameters:
        unit - The Unit that is demanding.
        colony - The Colony being demanded of.
        type - The GoodsType being demanded.
        amount - The amount of goods being demanded.
      • IndianDemandMessage

        public IndianDemandMessage​(Game game,
                                   FreeColXMLReader xr)
                            throws javax.xml.stream.XMLStreamException
        Create a new IndianDemandMessage 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)
        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.
      • getUnit

        public Unit getUnit​(Game game)
        Client-side convenience function to get the unit in this message.
        Parameters:
        game - The Game to look for the unit in.
        Returns:
        The Unit found.
      • getColony

        public Colony getColony​(Game game)
        Client-side convenience function to get the colony in this message.
        Parameters:
        game - The Game to look for the colony in.
        Returns:
        The Colony found.
      • getType

        public GoodsType getType​(Game game)
        Client-side convenience function to get the goods type in this message.
        Parameters:
        game - The Game to look for the goods type in.
        Returns:
        The GoodsType found.
      • getAmount

        public int getAmount()
        Client-side convenience function to get the gold in this message.
        Returns:
        The amount of gold specified by this message, or -1 if none or invalid.
      • getResult

        public Constants.IndianDemandAction getResult()
        Client-side convenience function to set the result of this message.
        Returns:
        The result of this demand.