Package net.sf.freecol.common.networking
Class ServerAPI
- java.lang.Object
-
- net.sf.freecol.common.networking.ServerAPI
-
- Direct Known Subclasses:
AIServerAPI,UserServerAPI
public abstract class ServerAPI extends java.lang.ObjectThe API for client/server messaging.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.Loggerlogger
-
Constructor Summary
Constructors Constructor Description ServerAPI()Creates a newServerAPI.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanabandonColony(Colony colony)Server query-response to abandon a colony.booleananswerMonarch(Monarch.MonarchAction action, boolean accept)Server query-response to respond to a monarch offer.private booleanask(Message message)Sends the specified message to the server and processes the reply.booleanaskSkill(Unit unit, Direction direction)Server query-response for finding out the skill taught at a settlement.booleanassignTeacher(Unit student, Unit teacher)Server query-response for assigning a teacher.booleanassignTradeRoute(Unit unit, TradeRoute tradeRoute)Server query-response for assigning a trade route to a unit.booleanattack(Unit unit, Direction direction)Server query-response for attacking.booleanbuildColony(java.lang.String name, Unit unit)Server query-response for building a colony.booleancashInTreasureTrain(Unit unit)Server query-response to cash in a treasure train.booleanchangeState(Unit unit, Unit.UnitState state)Server query-response for changing unit state.booleanchangeWorkImprovementType(Unit unit, TileImprovementType type)Server query-response for changing work improvement type.booleanchangeWorkType(Unit unit, GoodsType workType)Server query-response for changing work type.booleanchat(Player player, java.lang.String chat)Send a chat message (pre and in-game).private Connectioncheck(java.lang.String operation, java.lang.String type)Check the connection.booleanchooseFoundingFather(java.util.List<FoundingFather> ffs, FoundingFather ff)Send a chooseFoundingFather message.booleanclaimTile(Tile tile, FreeColGameObject claimant, int price)Server query-response to claim a tile.booleanclearSpeciality(Unit unit)Server query-response for clearing a unit speciality.abstract Connectionconnect(java.lang.String name, java.lang.String host, int port)Connects a client to host:port (or more).booleancontinuePlaying()Server query-response to continue with a won game.booleandeclareIndependence(java.lang.String nation, java.lang.String country)Server query-response for declaring independence.booleandeclineMounds(Unit unit, Direction direction)Server query-response for the special case of deciding to explore a rumour but then declining not to investigate the strange mounds.booleandeleteTradeRoute(TradeRoute tradeRoute)Server query-response for deleting a trade route.booleandeliverGiftToSettlement(Unit unit, IndianSettlement is, Goods goods)Server query-response to give the given goods to the natives.booleandemandTribute(Unit unit, Direction direction)Server query-response for demanding a tribute from a native settlement.booleandiplomacy(FreeColGameObject our, FreeColGameObject other, DiplomaticTrade dt)Handler server query-response for diplomatic messages.booleandisbandUnit(Unit unit)Server query-response for disbanding a unit.abstract booleandisconnect()Disconnect from the server.booleandisembark(Unit unit)Server query-response for disembarking from a carrier.booleanembark(Unit unit, Unit carrier, Direction direction)Server query-response for boarding a carrier.booleanemigrate(int slot)Server query-response for emigration.booleanendTurn()Server query-response for asking for the turn to end.booleanenterRevengeMode()Server query-response for asking to enter revenge mode (post-game).booleanequipUnitForRole(Unit unit, Role role, int roleCount)Server query-response for equipping a unit for a role.booleanfirstContact(Player player, Player other, Tile tile, boolean result)Server query-response for responding to a first contact message.abstract ConnectiongetConnection()Get the connection to communicate with the server.booleangetHighScores(java.lang.String key)Server query-response for asking for the high scores list.booleanincite(Unit unit, IndianSettlement is, Player enemy, int gold)Server query-response for inciting the natives.booleanindianDemand(Unit unit, Colony colony, GoodsType type, int amount, Constants.IndianDemandAction result)Makes demands to a colony.booleanisConnected()Convenience utility to check the connection.booleanjoinColony(Unit unit, Colony colony)Server query-response for joining a colony.booleanlearnSkill(Unit unit, Direction direction)Server query-response for learning the skill taught at a settlement.booleanloadGoods(Location loc, GoodsType type, int amount, Unit carrier)Server query-response for loading goods.booleanlogin(java.lang.String userName, java.lang.String version, boolean single, boolean current)Server query-response for logging in a player (pre-game).booleanlogout(Player player, Game.LogoutReason reason)Server query-response for logging out.booleanloot(Unit winner, java.lang.String defenderId, java.util.List<Goods> goods)Server query-response for looting.booleanmissionary(Unit unit, Direction direction, boolean denounce)Server query-response for establishing/denouncing a mission.booleanmove(Unit unit, Direction direction)Server query-response for moving a unit.booleanmoveTo(Unit unit, Location destination)Server query-response for moving to across the high seas.booleannationSummary(Player self, Player player)Server query-response for asking for the nation summary of a player.booleannativeGift(Unit unit, Colony colony)A native Unit delivers the gift it is carrying to a colony.booleannativeTrade(NativeTrade.NativeTradeAction action, NativeTrade nt)Server query-response for simple native trades.booleannewLandName(Unit unit, java.lang.String name)Server query-response for naming a new land.booleannewNativeTradeSession(Unit unit, IndianSettlement is)Server query-response to get the session for a trade.booleannewRegionName(Region region, Tile tile, Unit unit, java.lang.String name)Server query-response for naming a new region.booleannewTradeRoute()Server query-response for creating a new trade route.booleanpayArrears(GoodsType type)Server query-response for tax paying arrears.booleanpayForBuilding(Colony colony)Server query-response for paying for a building.booleanputOutsideColony(Unit unit)Server query-response for putting a unit outside a colony.booleanrearrangeColony(Colony colony, java.util.List<Unit> workers, Colony scratch)Rearrange a colony.abstract Connectionreconnect()Reconnect to the server.booleanrename(FreeColGameObject object, java.lang.String name)Server query-response for renaming an object.booleanrequestLaunch()Server query-response to launch the game (pre-game).booleanretire()Server query-response to retire the player from the game.booleanscoutSettlement(Unit unit, Direction direction)Server query-response for the dialog on scouting a native settlement, *before* choosing to speak to the chief, attack, et al.booleanscoutSpeakToChief(Unit unit, IndianSettlement is)Server query-response for speaking with a native chief.private booleansend(Message message)Sends a message to the server.booleansetAvailable(Nation nation, NationOptions.NationState state)Server query-response to set a nation's availablility (pre-game).booleansetBuildQueue(Colony colony, java.util.List<BuildableType> buildQueue)Server query-response for changing a build queue.booleansetColor(Nation nation, java.awt.Color color)Server query-response to set a nation colour (pre-game).booleansetCurrentStop(Unit unit, int index)Server query-response to set the current stop.booleansetDestination(Unit unit, Location destination)Server query-response to set the destination of the given unit.booleansetGoodsLevels(Colony colony, ExportData data)Server query-response for setting goods levels.voidsetMessageHandler(MessageHandler mh)Sets the message handler for the connection.booleansetNation(Nation nation)Server query-response to show which nation a player has selected (pre-game).booleansetNationType(NationType nationType)Server query-response to show which nation type a player has selected (pre-game).booleansetReady(boolean ready)Server query-response for indicating that this player is ready (pre-game).booleanspy(Unit unit, Settlement settlement)Server query-response for spying on a colony.booleanstartSkipping()Server query-response for starting to skip turns.booleantrainUnitInEurope(UnitType type)Server query-response for training a unit in Europe.booleanunloadGoods(GoodsType type, int amount, Unit carrier)Server query-response for unloading goods.booleanupdateGameOptions(OptionGroup gameOptions)Server query-response to update the game options (pre-game).booleanupdateMapGeneratorOptions(OptionGroup mapOptions)Server query-response to update the map generator options (pre-game).booleanupdateTradeRoute(TradeRoute route)Server query-response for asking for updating the trade route.booleanwork(Unit unit, WorkLocation workLocation)Server query-response for changing a work location.
-
-
-
Method Detail
-
connect
public abstract Connection connect(java.lang.String name, java.lang.String host, int port) throws java.io.IOException
Connects a client to host:port (or more).- Parameters:
name- The name for the thread.host- The name of the machine running theFreeColServer.port- The port to use when connecting to the host.- Returns:
- True if the connection succeeded.
- Throws:
java.io.IOException- on connection failure.
-
disconnect
public abstract boolean disconnect()
Disconnect from the server.- Returns:
- True if disconnected.
-
reconnect
public abstract Connection reconnect() throws java.io.IOException
Reconnect to the server.- Returns:
- The reestablished
Connection. - Throws:
java.io.IOException- on failure to connect.
-
getConnection
public abstract Connection getConnection()
Get the connection to communicate with the server.- Returns:
- The
Connectionto the server.
-
setMessageHandler
public void setMessageHandler(MessageHandler mh)
Sets the message handler for the connection.- Parameters:
mh- The newMessageHandler.
-
isConnected
public boolean isConnected()
Convenience utility to check the connection.- Returns:
- True if the server connection is open.
-
check
private Connection check(java.lang.String operation, java.lang.String type)
Check the connection.- Parameters:
operation- The proposed operation.type- The proposed type of message.- Returns:
- The
Connectionif valid, or null if not.
-
send
private boolean send(Message message)
Sends a message to the server.- Parameters:
message- TheMessageto send.- Returns:
- True if the send succeeded.
-
ask
private boolean ask(Message message)
Sends the specified message to the server and processes the reply. In following routines we follow the convention that server I/O is confined to the askfoo() routine, which typically returns true if the server interaction succeeded, which does *not* necessarily imply that the actual substance of the request was allowed (e.g. a move may result in the death of a unit rather than actually moving).- Parameters:
message- AMessageto send.- Returns:
- True if the server interaction succeeded, that is, there was no I/O problem and the reply was not an error message.
-
abandonColony
public boolean abandonColony(Colony colony)
Server query-response to abandon a colony.- Parameters:
colony- TheColonyto abandon.- Returns:
- True if the server interaction succeeded.
-
answerMonarch
public boolean answerMonarch(Monarch.MonarchAction action, boolean accept)
Server query-response to respond to a monarch offer.- Parameters:
action- The monarch action responded to.accept- Accept or reject the offer.- Returns:
- True if the server interaction succeeded.
-
askSkill
public boolean askSkill(Unit unit, Direction direction)
Server query-response for finding out the skill taught at a settlement.- Parameters:
unit- TheUnitthat is asking.direction- The direction to a settlement to ask.- Returns:
- True if the server interaction succeeded.
-
assignTeacher
public boolean assignTeacher(Unit student, Unit teacher)
Server query-response for assigning a teacher.- Parameters:
student- The studentUnit.teacher- The teacherUnit.- Returns:
- True if the server interaction succeeded.
-
assignTradeRoute
public boolean assignTradeRoute(Unit unit, TradeRoute tradeRoute)
Server query-response for assigning a trade route to a unit.- Parameters:
unit- TheUnitto assign a trade route to.tradeRoute- TheTradeRouteto assign.- Returns:
- True if the server interaction succeeded.
-
attack
public boolean attack(Unit unit, Direction direction)
Server query-response for attacking.- Parameters:
unit- TheUnitto perform the attack.direction- The direction in which to attack.- Returns:
- True if the server interaction succeeded.
-
buildColony
public boolean buildColony(java.lang.String name, Unit unit)Server query-response for building a colony.- Parameters:
name- The name for the colony.unit- TheUnitthat will build.- Returns:
- True if the server interaction succeeded.
-
cashInTreasureTrain
public boolean cashInTreasureTrain(Unit unit)
Server query-response to cash in a treasure train.- Parameters:
unit- The treasure trainUnitto cash in.- Returns:
- True if the server interaction succeeded.
-
changeState
public boolean changeState(Unit unit, Unit.UnitState state)
Server query-response for changing unit state.- Parameters:
unit- TheUnitto change the state of.state- The newUnitState.- Returns:
- boolean true if the server interaction succeeded.
-
changeWorkImprovementType
public boolean changeWorkImprovementType(Unit unit, TileImprovementType type)
Server query-response for changing work improvement type.- Parameters:
unit- TheUnitto change the work type of.type- The newTileImprovementTypeto work on.- Returns:
- True if the server interaction succeeded.
-
changeWorkType
public boolean changeWorkType(Unit unit, GoodsType workType)
Server query-response for changing work type.- Parameters:
unit- TheUnitto change the work type of.workType- The newGoodsTypeto produce.- Returns:
- True if the server interaction succeeded.
-
chat
public boolean chat(Player player, java.lang.String chat)
Send a chat message (pre and in-game).- Parameters:
player- ThePlayerto chat to.chat- The text of the message.- Returns:
- True if the send succeeded.
-
chooseFoundingFather
public boolean chooseFoundingFather(java.util.List<FoundingFather> ffs, FoundingFather ff)
Send a chooseFoundingFather message.- Parameters:
ffs- A list ofFoundingFathers to choose from.ff- The chosenFoundingFather(may be null).- Returns:
- True if the send succeeded.
-
claimTile
public boolean claimTile(Tile tile, FreeColGameObject claimant, int price)
Server query-response to claim a tile.- Parameters:
tile- TheTileto claim.claimant- TheUnitorSettlementthat is claiming the tile.price- The amount to pay.- Returns:
- True if the server interaction succeeded.
-
clearSpeciality
public boolean clearSpeciality(Unit unit)
Server query-response for clearing a unit speciality.- Parameters:
unit- TheUnitto operate on.- Returns:
- True if the server interaction succeeded.
-
continuePlaying
public boolean continuePlaying()
Server query-response to continue with a won game.- Returns:
- True if the server interaction succeeded.
-
declareIndependence
public boolean declareIndependence(java.lang.String nation, java.lang.String country)Server query-response for declaring independence.- Parameters:
nation- The name for the new nation.country- The name for the new country.- Returns:
- True if the server interaction succeeded.
-
declineMounds
public boolean declineMounds(Unit unit, Direction direction)
Server query-response for the special case of deciding to explore a rumour but then declining not to investigate the strange mounds.- Parameters:
unit- TheUnitthat is exploring.direction- TheDirectionto move.- Returns:
- True if the server interaction succeeded.
-
deleteTradeRoute
public boolean deleteTradeRoute(TradeRoute tradeRoute)
Server query-response for deleting a trade route.- Parameters:
tradeRoute- TheTradeRouteto delete.- Returns:
- True if the server interaction succeeded.
-
deliverGiftToSettlement
public boolean deliverGiftToSettlement(Unit unit, IndianSettlement is, Goods goods)
Server query-response to give the given goods to the natives.- Parameters:
unit- TheUnitthat is trading.is- TheIndianSettlementthat is trading.goods- TheGoodsto give.- Returns:
- True if the server interaction succeeded.
-
demandTribute
public boolean demandTribute(Unit unit, Direction direction)
Server query-response for demanding a tribute from a native settlement.- Parameters:
unit- TheUnitthat demands.direction- The direction to demand in.- Returns:
- True if the server interaction succeeded.
-
diplomacy
public boolean diplomacy(FreeColGameObject our, FreeColGameObject other, DiplomaticTrade dt)
Handler server query-response for diplomatic messages.- Parameters:
our- Our object (UnitorColony) conducting the diplomacy.other- The other object (UnitorColony) to negotiate with.dt- TheDiplomaticTradeagreement to propose.- Returns:
- The resulting agreement or null if none present.
-
disbandUnit
public boolean disbandUnit(Unit unit)
Server query-response for disbanding a unit.- Parameters:
unit- TheUnitto operate on.- Returns:
- True if the server interaction succeeded.
-
disembark
public boolean disembark(Unit unit)
Server query-response for disembarking from a carrier.- Parameters:
unit- TheUnitthat is disembarking.- Returns:
- True if the server interaction succeeded.
-
embark
public boolean embark(Unit unit, Unit carrier, Direction direction)
Server query-response for boarding a carrier.- Parameters:
unit- TheUnitthat is boarding.carrier- The carrierUnit.direction- An optional direction if the unit is boarding from an adjacent tile, or null if from the same tile.- Returns:
- True if the server interaction succeeded.
-
emigrate
public boolean emigrate(int slot)
Server query-response for emigration.- Parameters:
slot- The slot from which the unit migrates, 1-3 selects a specific one, otherwise the server will choose one.- Returns:
- True if the client-server interaction succeeded.
-
endTurn
public boolean endTurn()
Server query-response for asking for the turn to end.- Returns:
- True if the server interaction succeeded.
-
enterRevengeMode
public boolean enterRevengeMode()
Server query-response for asking to enter revenge mode (post-game).- Returns:
- True if the server interaction succeeded.
-
equipUnitForRole
public boolean equipUnitForRole(Unit unit, Role role, int roleCount)
Server query-response for equipping a unit for a role.- Parameters:
unit- TheUnitto equip.role- TheRoleto assume.roleCount- The role count.- Returns:
- True if the server interaction succeeded.
-
firstContact
public boolean firstContact(Player player, Player other, Tile tile, boolean result)
Server query-response for responding to a first contact message.- Parameters:
player- ThePlayermaking contact.other- The nativePlayerbeing contacted.tile- An optionalTileto offer the player if they have made a first landing.result- Whether the initial peace treaty was accepted.- Returns:
- True if the server interaction succeeded.
-
getHighScores
public boolean getHighScores(java.lang.String key)
Server query-response for asking for the high scores list.- Parameters:
key- The high score key to query.- Returns:
- True if the server interaction succeeded.
-
nationSummary
public boolean nationSummary(Player self, Player player)
Server query-response for asking for the nation summary of a player.- Parameters:
self- ThePlayerrequesting the summary.player- ThePlayerto summarize.- Returns:
- True if the server interaction succeeded.
-
incite
public boolean incite(Unit unit, IndianSettlement is, Player enemy, int gold)
Server query-response for inciting the natives.- Parameters:
unit- The missionaryUnit.is- TheIndianSettlementto incite.enemy- An enemyPlayer.gold- The amount of bribe, negative to enquire.- Returns:
- True if the server interaction succeeded.
-
indianDemand
public boolean indianDemand(Unit unit, Colony colony, GoodsType type, int amount, Constants.IndianDemandAction result)
Makes demands to a colony. One and only one of goods or gold is valid.- Parameters:
unit- TheUnitthat is demanding.colony- TheColonyto demand of.type- TheGoodsTypeto demand.amount- The amount of goods to demand.result- The result of the demand.- Returns:
- True if the server interaction succeeded.
-
joinColony
public boolean joinColony(Unit unit, Colony colony)
Server query-response for joining a colony.- Parameters:
unit- TheUnitthat will join.colony- TheColonyto join.- Returns:
- True if the server interaction succeeded.
-
learnSkill
public boolean learnSkill(Unit unit, Direction direction)
Server query-response for learning the skill taught at a settlement.- Parameters:
unit- TheUnitthat is asking.direction- The direction to a settlement to ask.- Returns:
- True if the server interaction succeeded.
-
loadGoods
public boolean loadGoods(Location loc, GoodsType type, int amount, Unit carrier)
Server query-response for loading goods.- Parameters:
loc- TheLocationwhere the goods are.type- TheGoodsTypeto load.amount- The amount of goods to load.carrier- TheUnitto load onto.- Returns:
- True if the server interaction succeeded.
-
login
public boolean login(java.lang.String userName, java.lang.String version, boolean single, boolean current)Server query-response for logging in a player (pre-game).- Parameters:
userName- The user name.version- The client version.single- True if this is a single player login.current- True if the requesting player should become the current player.- Returns:
- True if the server interaction succeeded.
-
logout
public boolean logout(Player player, Game.LogoutReason reason)
Server query-response for logging out.- Parameters:
player- ThePlayerthat has logged out.reason- The reason for logging out.- Returns:
- True if the server interaction succeeded.
-
loot
public boolean loot(Unit winner, java.lang.String defenderId, java.util.List<Goods> goods)
Server query-response for looting. Handles both an initial query and the actual looting.- Parameters:
winner- TheUnitthat is looting.defenderId- The identifier of the defender unit (it may have sunk).goods- A list ofGoods, if empty this is a query as to what is to be looted which is filled into the list, if non-empty, then the list of goods to loot.- Returns:
- True if the server interaction succeeded.
-
missionary
public boolean missionary(Unit unit, Direction direction, boolean denounce)
Server query-response for establishing/denouncing a mission.- Parameters:
unit- The missionaryUnit.direction- The direction to a settlement to establish with.denounce- True if this is a denouncement.- Returns:
- True if the server interaction succeeded.
-
move
public boolean move(Unit unit, Direction direction)
Server query-response for moving a unit.- Parameters:
unit- TheUnitto move.direction- The direction to move in.- Returns:
- True if the server interaction succeeded.
-
moveTo
public boolean moveTo(Unit unit, Location destination)
Server query-response for moving to across the high seas.- Parameters:
unit- TheUnitto move.destination- TheLocationto move to.- Returns:
- True if the server interaction succeeded.
-
nativeGift
public boolean nativeGift(Unit unit, Colony colony)
A native Unit delivers the gift it is carrying to a colony.- Parameters:
unit- TheUnitdelivering the gift.colony- TheColonyto give to.- Returns:
- True if the server interaction succeeded.
-
newLandName
public boolean newLandName(Unit unit, java.lang.String name)
Server query-response for naming a new land.- Parameters:
unit- TheUnitthat has come ashore.name- The new land name.- Returns:
- True if the server interaction succeeded.
-
nativeTrade
public boolean nativeTrade(NativeTrade.NativeTradeAction action, NativeTrade nt)
Server query-response for simple native trades.- Parameters:
nt- TheNativeTradeunderway.action- TheNativeTradeActionto perform.- Returns:
- True if the server interaction succeeded.
-
newNativeTradeSession
public boolean newNativeTradeSession(Unit unit, IndianSettlement is)
Server query-response to get the session for a trade.- Parameters:
unit- TheUnitthat is trading.is- TheIndianSettlementthat is trading.- Returns:
- True if the server interaction succeeded.
-
newRegionName
public boolean newRegionName(Region region, Tile tile, Unit unit, java.lang.String name)
Server query-response for naming a new region.- Parameters:
region- TheRegionthat is being discovered.tile- TheTilewhere the region is discovered.unit- TheUnitdiscovering the region.name- The new region name.- Returns:
- True if the server interaction succeeded.
-
newTradeRoute
public boolean newTradeRoute()
Server query-response for creating a new trade route.- Returns:
- True if the server interaction succeeded.
-
payArrears
public boolean payArrears(GoodsType type)
Server query-response for tax paying arrears.- Parameters:
type- TheGoodsTypeto pay the arrears for.- Returns:
- True if the server interaction succeeded.
-
payForBuilding
public boolean payForBuilding(Colony colony)
Server query-response for paying for a building.- Parameters:
colony- TheColonythat is building.- Returns:
- True if the server interaction succeeded.
-
putOutsideColony
public boolean putOutsideColony(Unit unit)
Server query-response for putting a unit outside a colony.- Parameters:
unit- TheUnitto put out.- Returns:
- True if the server interaction succeeded.
-
rearrangeColony
public boolean rearrangeColony(Colony colony, java.util.List<Unit> workers, Colony scratch)
Rearrange a colony.- Parameters:
colony- TheColonyto rearrange.workers- A list of workerUnits that may change.scratch- A copy of the underlyingColonywith the workers arranged as required.- Returns:
- True if the server interaction succeeds.
-
rename
public boolean rename(FreeColGameObject object, java.lang.String name)
Server query-response for renaming an object.- Parameters:
object- AFreeColGameObjectto rename.name- The name to apply.- Returns:
- True if the server interaction succeeded.
-
requestLaunch
public boolean requestLaunch()
Server query-response to launch the game (pre-game).- Returns:
- True if the server interaction succeeded.
-
retire
public boolean retire()
Server query-response to retire the player from the game.- Returns:
- True if the server interaction succeeded.
-
scoutSettlement
public boolean scoutSettlement(Unit unit, Direction direction)
Server query-response for the dialog on scouting a native settlement, *before* choosing to speak to the chief, attack, et al.- Parameters:
unit- TheUnitthat is speaking.direction- The direction to a settlement to ask.- Returns:
- True if the server interaction succeeded.
-
scoutSpeakToChief
public boolean scoutSpeakToChief(Unit unit, IndianSettlement is)
Server query-response for speaking with a native chief.- Parameters:
unit- TheUnitthat is speaking.is- TheIndianSettlementto ask.- Returns:
- True if the server interaction succeeded.
-
setAvailable
public boolean setAvailable(Nation nation, NationOptions.NationState state)
Server query-response to set a nation's availablility (pre-game).- Parameters:
nation- TheNationto whose availability is to be set.state- TheNationStatedefining the availability.- Returns:
- True if the server interaction succeeded.
-
setBuildQueue
public boolean setBuildQueue(Colony colony, java.util.List<BuildableType> buildQueue)
Server query-response for changing a build queue.- Parameters:
colony- the ColonybuildQueue- the new values for the build queue- Returns:
- True if the server interaction succeeded.
-
setColor
public boolean setColor(Nation nation, java.awt.Color color)
Server query-response to set a nation colour (pre-game).- Parameters:
nation- TheNationto set the color for.color- TheColorselected.- Returns:
- True if the server interaction succeeded.
-
setCurrentStop
public boolean setCurrentStop(Unit unit, int index)
Server query-response to set the current stop.- Parameters:
unit- TheUnitwhose stop is to be updated.index- The stop index.- Returns:
- True if the query-response succeeds.
-
setDestination
public boolean setDestination(Unit unit, Location destination)
Server query-response to set the destination of the given unit.- Parameters:
unit- TheUnitto direct.destination- The destinationLocation.- Returns:
- True if the server interaction succeeded.
- See Also:
Unit.setDestination(Location)
-
setGoodsLevels
public boolean setGoodsLevels(Colony colony, ExportData data)
Server query-response for setting goods levels.- Parameters:
colony- TheColonywhere the levels are set.data- TheExportDatasetting.- Returns:
- True if the server interaction succeeded.
-
setNation
public boolean setNation(Nation nation)
Server query-response to show which nation a player has selected (pre-game).- Parameters:
nation- TheNationselected.- Returns:
- True if the server interaction succeeded.
-
setNationType
public boolean setNationType(NationType nationType)
Server query-response to show which nation type a player has selected (pre-game).- Parameters:
nationType- TheNationTypeselected.- Returns:
- True if the server interaction succeeded.
-
setReady
public boolean setReady(boolean ready)
Server query-response for indicating that this player is ready (pre-game).- Parameters:
ready- The readiness state to signal.- Returns:
- True if the server interaction succeeded.
-
spy
public boolean spy(Unit unit, Settlement settlement)
Server query-response for spying on a colony.- Parameters:
unit- TheUnitthat is spying.settlement- TheSettlementto spy on.- Returns:
- True if the client/server interaction succeeded.
-
startSkipping
public boolean startSkipping()
Server query-response for starting to skip turns.- Returns:
- True if the server interaction succeeded.
-
trainUnitInEurope
public boolean trainUnitInEurope(UnitType type)
Server query-response for training a unit in Europe.- Parameters:
type- TheUnitTypeto train.- Returns:
- True if the server interaction succeeded.
-
unloadGoods
public boolean unloadGoods(GoodsType type, int amount, Unit carrier)
Server query-response for unloading goods.- Parameters:
type- TheGoodsTypeto unload.amount- The amount of goods to unload.carrier- TheUnitto unload from.- Returns:
- True if the query-response succeeds.
-
updateGameOptions
public boolean updateGameOptions(OptionGroup gameOptions)
Server query-response to update the game options (pre-game).- Parameters:
gameOptions- TheOptionGroupcontaining the game options.- Returns:
- True if the server interaction succeeded.
-
updateMapGeneratorOptions
public boolean updateMapGeneratorOptions(OptionGroup mapOptions)
Server query-response to update the map generator options (pre-game).- Parameters:
mapOptions- TheOptionGroupcontaining the map generator options.- Returns:
- True if the server interaction succeeded.
-
updateTradeRoute
public boolean updateTradeRoute(TradeRoute route)
Server query-response for asking for updating the trade route.- Parameters:
route- The trade route to update.- Returns:
- True if the server interaction succeeded.
-
work
public boolean work(Unit unit, WorkLocation workLocation)
Server query-response for changing a work location.- Parameters:
unit- TheUnitto change the workLocation of.workLocation- TheWorkLocationto change to.- Returns:
- True if the server interaction succeeded.
-
-