Package net.sf.freecol.server.control
Class PreGameController
- java.lang.Object
-
- net.sf.freecol.server.control.FreeColServerHolder
-
- net.sf.freecol.server.control.Controller
-
- net.sf.freecol.server.control.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 stateFreeColServer.ServerState.IN_GAME
, when the has successfully been invoked.
-
-
Constructor Summary
Constructors Constructor Description PreGameController(FreeColServer freeColServer)
The constructor to use.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChangeSet
ready(ServerPlayer serverPlayer, boolean ready)
A player changes its readiness.ChangeSet
requestLaunch(ServerPlayer serverPlayer)
Launch the game if possible.ChangeSet
setAvailable(ServerPlayer serverPlayer, Nation nation, NationOptions.NationState state)
Handle a player changing its availability.ChangeSet
setColor(ServerPlayer serverPlayer, Nation nation, java.awt.Color color)
Handle a player changing its color.private boolean
setLaunching(boolean launching)
Set the launching state.ChangeSet
setNation(ServerPlayer serverPlayer, Nation nation)
Handle a player changing its nation.ChangeSet
setNationType(ServerPlayer serverPlayer, NationType nationType)
Handle a player changing its nation type.ChangeSet
updateGameOptions(ServerPlayer serverPlayer, OptionGroup options)
Handle a player changing its game options.ChangeSet
updateMapGeneratorOptions(ServerPlayer serverPlayer, OptionGroup options)
Handle a player changing its map generator options.ChangeSet
vacantPlayers()
Handle a request for vacant players.-
Methods inherited from class net.sf.freecol.server.control.Controller
shutdown
-
Methods inherited from class net.sf.freecol.server.control.FreeColServerHolder
getFreeColServer, getGame
-
-
-
-
Constructor Detail
-
PreGameController
public PreGameController(FreeColServer freeColServer)
The constructor to use.- Parameters:
freeColServer
- The mainFreeColServer
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
- TheServerPlayer
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
- TheServerPlayer
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
- TheServerPlayer
that changed.nation
- The changedNation
.state
- The newNationState
.- 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
- TheServerPlayer
that changed.nation
- The changedNation
.color
- The newColor
.- Returns:
- A
ChangeSet
encapsulating this action.
-
setNation
public ChangeSet setNation(ServerPlayer serverPlayer, Nation nation)
Handle a player changing its nation.- Parameters:
serverPlayer
- TheServerPlayer
that changed.nation
- The changedNation
.- Returns:
- A
ChangeSet
encapsulating this action.
-
setNationType
public ChangeSet setNationType(ServerPlayer serverPlayer, NationType nationType)
Handle a player changing its nation type.- Parameters:
serverPlayer
- TheServerPlayer
that changed.nationType
- The changedNationType
.- Returns:
- A
ChangeSet
encapsulating this action.
-
updateGameOptions
public ChangeSet updateGameOptions(ServerPlayer serverPlayer, OptionGroup options)
Handle a player changing its game options.- Parameters:
serverPlayer
- TheServerPlayer
that changed.options
- The newOptionGroup
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
- TheServerPlayer
that changed.options
- The newOptionGroup
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.
-
-