Class SetNationMessage


  • public class SetNationMessage
    extends AttributeMessage
    The message that sets the player nation.
    • Constructor Detail

      • SetNationMessage

        public SetNationMessage​(Player player,
                                Nation nation)
        Create a new SetNationMessage.
        Parameters:
        player - The Player to set the nation for.
        nation - The Nation to set.
      • SetNationMessage

        public SetNationMessage​(Game game,
                                FreeColXMLReader xr)
                         throws javax.xml.stream.XMLStreamException
        Create a new SetNationMessage 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 nation.
        Parameters:
        game - The Game to look up the player in.
        Returns:
        The Player found, or null.
      • getValue

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