Class LootCargoMessage


  • public class LootCargoMessage
    extends ObjectMessage
    The message sent when looting cargo.
    • Constructor Detail

      • LootCargoMessage

        public LootCargoMessage​(Unit winner,
                                java.lang.String loserId,
                                java.util.List<Goods> goods)
        Create a new LootCargoMessage.
        Parameters:
        winner - The Unit that is looting.
        loserId - The identifier of the Unit that is looted.
        goods - The AbstractGoods to loot.
      • LootCargoMessage

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

      • getWinner

        private Unit getWinner​(Game game)
        Accessor for the winning unit.
        Parameters:
        game - The Game to look for the unit in.
        Returns:
        The winner unit.
      • getLoserId

        private java.lang.String getLoserId()
        Accessor for the losing unit identifier.
        Returns:
        The loser unit object Identifier.
      • getGoods

        private java.util.List<Goods> getGoods()
        Accessor for the goods to loot.
        Returns:
        The goods to loot.
      • 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.