Class PreGameController


  • public final class PreGameController
    extends Controller
    The control object that is responsible for setting parameters and starting a new game. The game enters the state FreeColServer.ServerState.IN_GAME, when the has successfully been invoked.
    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
      • launching

        private boolean launching
        Is the game launching yet.
    • Constructor Detail

      • PreGameController

        public PreGameController​(FreeColServer freeColServer)
        The constructor to use.
        Parameters:
        freeColServer - The main FreeColServer object.
    • Method Detail

      • setLaunching

        private boolean setLaunching​(boolean launching)
        Set the launching state.
        Parameters:
        launching - The new launching state.
        Returns:
        The former launching state.
      • ready

        public ChangeSet ready​(ServerPlayer serverPlayer,
                               boolean ready)
        A player changes its readiness.
        Parameters:
        serverPlayer - The ServerPlayer that changes its state.
        ready - The new readiness.
        Returns:
        A ChangeSet encapsulating this action.
      • requestLaunch

        public ChangeSet requestLaunch​(ServerPlayer serverPlayer)
        Launch the game if possible.
        Parameters:
        serverPlayer - The ServerPlayer that requested launching.
        Returns:
        A ChangeSet encapsulating this action.
      • setAvailable

        public ChangeSet setAvailable​(ServerPlayer serverPlayer,
                                      Nation nation,
                                      NationOptions.NationState state)
        Handle a player changing its availability.
        Parameters:
        serverPlayer - The ServerPlayer that changed.
        nation - The changed Nation.
        state - The new NationState.
        Returns:
        A ChangeSet encapsulating this action.
      • setColor

        public ChangeSet setColor​(ServerPlayer serverPlayer,
                                  Nation nation,
                                  java.awt.Color color)
        Handle a player changing its color.
        Parameters:
        serverPlayer - The ServerPlayer that changed.
        nation - The changed Nation.
        color - The new Color.
        Returns:
        A ChangeSet encapsulating this action.
      • setNation

        public ChangeSet setNation​(ServerPlayer serverPlayer,
                                   Nation nation)
        Handle a player changing its nation.
        Parameters:
        serverPlayer - The ServerPlayer that changed.
        nation - The changed Nation.
        Returns:
        A ChangeSet encapsulating this action.
      • setNationType

        public ChangeSet setNationType​(ServerPlayer serverPlayer,
                                       NationType nationType)
        Handle a player changing its nation type.
        Parameters:
        serverPlayer - The ServerPlayer that changed.
        nationType - The changed NationType.
        Returns:
        A ChangeSet encapsulating this action.
      • updateGameOptions

        public ChangeSet updateGameOptions​(ServerPlayer serverPlayer,
                                           OptionGroup options)
        Handle a player changing its game options.
        Parameters:
        serverPlayer - The ServerPlayer that changed.
        options - The new OptionGroup containing the game options.
        Returns:
        A ChangeSet encapsulating this action.
      • updateMapGeneratorOptions

        public ChangeSet updateMapGeneratorOptions​(ServerPlayer serverPlayer,
                                                   OptionGroup options)
        Handle a player changing its map generator options.
        Parameters:
        serverPlayer - The ServerPlayer that changed.
        options - The new OptionGroup containing the map generator options.
        Returns:
        A ChangeSet encapsulating this action.
      • vacantPlayers

        public ChangeSet vacantPlayers()
        Handle a request for vacant players.
        Returns:
        A ChangeSet encapsulating this action.