Class SetStanceMessage


  • public class SetStanceMessage
    extends AttributeMessage
    The message sent to the clients to signal a stance change.
    • Constructor Detail

      • SetStanceMessage

        public SetStanceMessage​(Stance stance,
                                Player first,
                                Player second)
        Create a new SetStanceMessage with the given stance and players.
        Parameters:
        stance - The new Stance.
        first - The Player whose stance is changing.
        second - The Player the stance is changed with respect to.
      • SetStanceMessage

        public SetStanceMessage​(Game game,
                                FreeColXMLReader xr)
                         throws javax.xml.stream.XMLStreamException
        Create a new SetStanceMessage from a stream.
        Parameters:
        game - The Game this message belongs to (null here).
        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.
      • getStance

        public Stance getStance()
        Get the stance that changed.
        Returns:
        The Stance value.
      • getFirstPlayer

        public Player getFirstPlayer​(Game game)
        Which player is changing stance?
        Parameters:
        game - The Game the player is in.
        Returns:
        The player whose stance changes.
      • getSecondPlayer

        public Player getSecondPlayer​(Game game)
        Which player is the stance changed with respect to?
        Parameters:
        game - The Game the player is in.
        Returns:
        The player the stance changed to.