Class SetNationTypeMessage


  • public class SetNationTypeMessage
    extends AttributeMessage
    The message that sets the player nationType.
    • Constructor Detail

      • SetNationTypeMessage

        public SetNationTypeMessage​(Player player,
                                    NationType nationType)
        Create a new SetNationTypeMessage.
        Parameters:
        player - The Player to change the type for.
        nationType - The NationType to set.
      • SetNationTypeMessage

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

      • 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.
      • getPlayer

        public Player getPlayer​(Game game)
        Get the player that is setting its nationType.
        Parameters:
        game - The Game to look up the player in.
        Returns:
        The Player found, or null.
      • getValue

        public NationType getValue​(Specification spec)
        Get the nationType to set.
        Parameters:
        spec - The Specification to look up the nationType in.
        Returns:
        The NationType.