Class DiplomacyMessage


  • public class DiplomacyMessage
    extends ObjectMessage
    The message sent when executing a diplomatic trade.
    • Constructor Detail

      • DiplomacyMessage

        public DiplomacyMessage​(FreeColGameObject our,
                                FreeColGameObject other,
                                DiplomaticTrade agreement)
        Create a new DiplomacyMessage.
        Parameters:
        our - Our FreeColGameObject that is negotiating.
        other - The other FreeColGameObject to negotiate with.
        agreement - The DiplomaticTrade to make.
      • DiplomacyMessage

        public DiplomacyMessage​(Unit unit,
                                Unit otherUnit,
                                DiplomaticTrade agreement)
        Create a new DiplomacyMessage.
        Parameters:
        unit - The Unit that is negotiating.
        otherUnit - The other Unit to negotiate with.
        agreement - The DiplomaticTrade to make.
      • DiplomacyMessage

        public DiplomacyMessage​(Unit unit,
                                Colony colony,
                                DiplomaticTrade agreement)
        Create a new DiplomacyMessage.
        Parameters:
        unit - The Unit that is negotiating.
        colony - The Colony to negotiate with.
        agreement - The DiplomaticTrade to make.
      • DiplomacyMessage

        public DiplomacyMessage​(Colony colony,
                                Unit unit,
                                DiplomaticTrade agreement)
        Create a new DiplomacyMessage.
        Parameters:
        colony - The Colony that is negotiating.
        unit - The Unit that to negotiate with.
        agreement - The DiplomaticTrade to make.
      • DiplomacyMessage

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

      • getOurFCGO

        private FreeColGameObject getOurFCGO​(Game game)
        Get our FCGO.
        Parameters:
        game - The Game to extract the FCGO from.
        Returns:
        Our FreeColGameObject.
      • getOtherFCGO

        private FreeColGameObject getOtherFCGO​(Game game)
        Get the other FCGO.
        Parameters:
        game - The Game to extract the FCGO from.
        Returns:
        The other FreeColGameObject.
      • getAgreement

        private DiplomaticTrade getAgreement()
        Get the agreement (a DiplomaticTrade) in this message.
        Returns:
        The agreement in this message.
      • getExtraUnit

        private Unit getExtraUnit()
        Get the extra Unit.
        Returns:
        The extra Unit, or null if none.
      • 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.