Class SetAIMessage


  • public class SetAIMessage
    extends AttributeMessage
    The message that changes the AI state of a player.
    • Constructor Detail

      • SetAIMessage

        public SetAIMessage​(Player player,
                            boolean ai)
        Create a new SetAIMessage with the given player and state.
        Parameters:
        player - The Player to set.
        ai - The new AI state.
      • SetAIMessage

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

        public Player getPlayer​(Game game)
        Which player is to be set?
        Parameters:
        game - The Game the player is in.
        Returns:
        The Player to set the AI state of.
      • getAI

        public boolean getAI()
        What AI state should be set?
        Returns:
        The AI state.