Class RearrangeColonyMessage


  • public class RearrangeColonyMessage
    extends AttributeMessage
    The message sent when the client requests rearrangeing of a colony.
    • Constructor Detail

      • RearrangeColonyMessage

        public RearrangeColonyMessage​(Colony colony,
                                      java.util.List<Unit> workers,
                                      Colony scratch)
        Create a new RearrangeColonyMessage with the supplied colony. Add changes with addChange().
        Parameters:
        colony - The Colony that is rearranging.
        workers - A list of worker Units to rearrange.
        scratch - A scratch Colony laid out as required.
      • RearrangeColonyMessage

        public RearrangeColonyMessage​(Game game,
                                      FreeColXMLReader xr)
        Create a new RearrangeColonyMessage from a stream.
        Parameters:
        game - The Game to read within.
        xr - The FreeColXMLReader to read from.
    • Method Detail

      • getAttributeMap

        private static java.util.Map<java.lang.String,​java.lang.String> getAttributeMap​(FreeColXMLReader xr)
        Read the attributes from the stream.
        Parameters:
        xr - The FreeColXMLReader to read from.
        Returns:
        An attribute map.
      • setArrangementAttributes

        private void setArrangementAttributes​(java.util.List<RearrangeColonyMessage.Arrangement> arrangements)
        Set the attributes consequent to a list of arrangements.
        Parameters:
        arrangements - The list of Arrangement.
      • currentPlayerMessage

        public boolean currentPlayerMessage()
        Should this message only be sent to a server by the current player?
        Overrides:
        currentPlayerMessage in class TrivialMessage
        Returns:
        True if this is a current-player-only 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.
      • isEmpty

        public boolean isEmpty()
        Check if the are no arrangements present.
        Overrides:
        isEmpty in class Message
        Returns:
        True if there are no arrangements.
      • getArrangements

        public java.util.List<RearrangeColonyMessage.Arrangement> getArrangements​(Game game)
        Get arrangements from the attributes.
        Parameters:
        game - The Game to create arrangements in.
        Returns:
        A list of Arrangements.