Class FeatureChangeMessage


  • public class FeatureChangeMessage
    extends ObjectMessage
    The message sent when to add or remove a feature.
    • Constructor Detail

      • FeatureChangeMessage

        public FeatureChangeMessage​(FreeColGameObject fcgo,
                                    FreeColObject fco,
                                    boolean add)
        Create a new FeatureChangeMessage for the game object and feature.
        Parameters:
        fcgo - The parent FreeColGameObject to manipulate.
        fco - The FreeColObject to add or remove.
        add - If true the object is added.
      • FeatureChangeMessage

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

      • getParentId

        private java.lang.String getParentId()
        Get the parent object identifier.
        Returns:
        The parent identifier.
      • getParent

        private FreeColGameObject getParent​(Game game)
        Get the parent object to add/remove to.
        Parameters:
        game - The Game to look in.
        Returns:
        The parent FreeColGameObject.
      • getAdd

        private boolean getAdd()
        Get the add/remove state.
        Returns:
        True if the child object should be added to the parent.
      • merge

        public boolean merge​(Message message)
        Merge another message into this message if possible.
        Overrides:
        merge in class Message
        Parameters:
        message - The Message to merge.
        Returns:
        True if the other message was merged.
      • 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.