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.Object
The API for client/server messaging.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.Logger
logger
-
Constructor Summary
Constructors Constructor Description ServerAPI()
Creates a newServerAPI
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
abandonColony(Colony colony)
Server query-response to abandon a colony.boolean
answerMonarch(Monarch.MonarchAction action, boolean accept)
Server query-response to respond to a monarch offer.private boolean
ask(Message message)
Sends the specified message to the server and processes the reply.boolean
askSkill(Unit unit, Direction direction)
Server query-response for finding out the skill taught at a settlement.boolean
assignTeacher(Unit student, Unit teacher)
Server query-response for assigning a teacher.boolean
assignTradeRoute(Unit unit, TradeRoute tradeRoute)
Server query-response for assigning a trade route to a unit.boolean
attack(Unit unit, Direction direction)
Server query-response for attacking.boolean
buildColony(java.lang.String name, Unit unit)
Server query-response for building a colony.boolean
cashInTreasureTrain(Unit unit)
Server query-response to cash in a treasure train.boolean
changeState(Unit unit, Unit.UnitState state)
Server query-response for changing unit state.boolean
changeWorkImprovementType(Unit unit, TileImprovementType type)
Server query-response for changing work improvement type.boolean
changeWorkType(Unit unit, GoodsType workType)
Server query-response for changing work type.boolean
chat(Player player, java.lang.String chat)
Send a chat message (pre and in-game).private Connection
check(java.lang.String operation, java.lang.String type)
Check the connection.boolean
chooseFoundingFather(java.util.List<FoundingFather> ffs, FoundingFather ff)
Send a chooseFoundingFather message.boolean
claimTile(Tile tile, FreeColGameObject claimant, int price)
Server query-response to claim a tile.boolean
clearSpeciality(Unit unit)
Server query-response for clearing a unit speciality.abstract Connection
connect(java.lang.String name, java.lang.String host, int port)
Connects a client to host:port (or more).boolean
continuePlaying()
Server query-response to continue with a won game.boolean
declareIndependence(java.lang.String nation, java.lang.String country)
Server query-response for declaring independence.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.boolean
deleteTradeRoute(TradeRoute tradeRoute)
Server query-response for deleting a trade route.boolean
deliverGiftToSettlement(Unit unit, IndianSettlement is, Goods goods)
Server query-response to give the given goods to the natives.boolean
demandTribute(Unit unit, Direction direction)
Server query-response for demanding a tribute from a native settlement.boolean
diplomacy(FreeColGameObject our, FreeColGameObject other, DiplomaticTrade dt)
Handler server query-response for diplomatic messages.boolean
disbandUnit(Unit unit)
Server query-response for disbanding a unit.abstract boolean
disconnect()
Disconnect from the server.boolean
disembark(Unit unit)
Server query-response for disembarking from a carrier.boolean
embark(Unit unit, Unit carrier, Direction direction)
Server query-response for boarding a carrier.boolean
emigrate(int slot)
Server query-response for emigration.boolean
endTurn()
Server query-response for asking for the turn to end.boolean
enterRevengeMode()
Server query-response for asking to enter revenge mode (post-game).boolean
equipUnitForRole(Unit unit, Role role, int roleCount)
Server query-response for equipping a unit for a role.boolean
firstContact(Player player, Player other, Tile tile, boolean result)
Server query-response for responding to a first contact message.abstract Connection
getConnection()
Get the connection to communicate with the server.boolean
getHighScores(java.lang.String key)
Server query-response for asking for the high scores list.boolean
incite(Unit unit, IndianSettlement is, Player enemy, int gold)
Server query-response for inciting the natives.boolean
indianDemand(Unit unit, Colony colony, GoodsType type, int amount, Constants.IndianDemandAction result)
Makes demands to a colony.boolean
isConnected()
Convenience utility to check the connection.boolean
joinColony(Unit unit, Colony colony)
Server query-response for joining a colony.boolean
learnSkill(Unit unit, Direction direction)
Server query-response for learning the skill taught at a settlement.boolean
loadGoods(Location loc, GoodsType type, int amount, Unit carrier)
Server query-response for loading goods.boolean
login(java.lang.String userName, java.lang.String version, boolean single, boolean current)
Server query-response for logging in a player (pre-game).boolean
logout(Player player, Game.LogoutReason reason)
Server query-response for logging out.boolean
loot(Unit winner, java.lang.String defenderId, java.util.List<Goods> goods)
Server query-response for looting.boolean
missionary(Unit unit, Direction direction, boolean denounce)
Server query-response for establishing/denouncing a mission.boolean
move(Unit unit, Direction direction)
Server query-response for moving a unit.boolean
moveTo(Unit unit, Location destination)
Server query-response for moving to across the high seas.boolean
nationSummary(Player self, Player player)
Server query-response for asking for the nation summary of a player.boolean
nativeGift(Unit unit, Colony colony)
A native Unit delivers the gift it is carrying to a colony.boolean
nativeTrade(NativeTrade.NativeTradeAction action, NativeTrade nt)
Server query-response for simple native trades.boolean
newLandName(Unit unit, java.lang.String name)
Server query-response for naming a new land.boolean
newNativeTradeSession(Unit unit, IndianSettlement is)
Server query-response to get the session for a trade.boolean
newRegionName(Region region, Tile tile, Unit unit, java.lang.String name)
Server query-response for naming a new region.boolean
newTradeRoute()
Server query-response for creating a new trade route.boolean
payArrears(GoodsType type)
Server query-response for tax paying arrears.boolean
payForBuilding(Colony colony)
Server query-response for paying for a building.boolean
putOutsideColony(Unit unit)
Server query-response for putting a unit outside a colony.boolean
rearrangeColony(Colony colony, java.util.List<Unit> workers, Colony scratch)
Rearrange a colony.abstract Connection
reconnect()
Reconnect to the server.boolean
rename(FreeColGameObject object, java.lang.String name)
Server query-response for renaming an object.boolean
requestLaunch()
Server query-response to launch the game (pre-game).boolean
retire()
Server query-response to retire the player from the game.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.boolean
scoutSpeakToChief(Unit unit, IndianSettlement is)
Server query-response for speaking with a native chief.private boolean
send(Message message)
Sends a message to the server.boolean
setAvailable(Nation nation, NationOptions.NationState state)
Server query-response to set a nation's availablility (pre-game).boolean
setBuildQueue(Colony colony, java.util.List<BuildableType> buildQueue)
Server query-response for changing a build queue.boolean
setColor(Nation nation, java.awt.Color color)
Server query-response to set a nation colour (pre-game).boolean
setCurrentStop(Unit unit, int index)
Server query-response to set the current stop.boolean
setDestination(Unit unit, Location destination)
Server query-response to set the destination of the given unit.boolean
setGoodsLevels(Colony colony, ExportData data)
Server query-response for setting goods levels.void
setMessageHandler(MessageHandler mh)
Sets the message handler for the connection.boolean
setNation(Nation nation)
Server query-response to show which nation a player has selected (pre-game).boolean
setNationType(NationType nationType)
Server query-response to show which nation type a player has selected (pre-game).boolean
setReady(boolean ready)
Server query-response for indicating that this player is ready (pre-game).boolean
spy(Unit unit, Settlement settlement)
Server query-response for spying on a colony.boolean
startSkipping()
Server query-response for starting to skip turns.boolean
trainUnitInEurope(UnitType type)
Server query-response for training a unit in Europe.boolean
unloadGoods(GoodsType type, int amount, Unit carrier)
Server query-response for unloading goods.boolean
updateGameOptions(OptionGroup gameOptions)
Server query-response to update the game options (pre-game).boolean
updateMapGeneratorOptions(OptionGroup mapOptions)
Server query-response to update the map generator options (pre-game).boolean
updateTradeRoute(TradeRoute route)
Server query-response for asking for updating the trade route.boolean
work(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
Connection
to 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
Connection
if valid, or null if not.
-
send
private boolean send(Message message)
Sends a message to the server.- Parameters:
message
- TheMessage
to 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
- AMessage
to 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
- TheColony
to 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
- TheUnit
that 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
- TheUnit
to assign a trade route to.tradeRoute
- TheTradeRoute
to assign.- Returns:
- True if the server interaction succeeded.
-
attack
public boolean attack(Unit unit, Direction direction)
Server query-response for attacking.- Parameters:
unit
- TheUnit
to 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
- TheUnit
that 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 trainUnit
to 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
- TheUnit
to 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
- TheUnit
to change the work type of.type
- The newTileImprovementType
to 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
- TheUnit
to change the work type of.workType
- The newGoodsType
to 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
- ThePlayer
to 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 ofFoundingFather
s 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
- TheTile
to claim.claimant
- TheUnit
orSettlement
that 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
- TheUnit
to 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
- TheUnit
that is exploring.direction
- TheDirection
to move.- Returns:
- True if the server interaction succeeded.
-
deleteTradeRoute
public boolean deleteTradeRoute(TradeRoute tradeRoute)
Server query-response for deleting a trade route.- Parameters:
tradeRoute
- TheTradeRoute
to 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
- TheUnit
that is trading.is
- TheIndianSettlement
that is trading.goods
- TheGoods
to 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
- TheUnit
that 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 (Unit
orColony
) conducting the diplomacy.other
- The other object (Unit
orColony
) to negotiate with.dt
- TheDiplomaticTrade
agreement 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
- TheUnit
to 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
- TheUnit
that 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
- TheUnit
that 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
- TheUnit
to equip.role
- TheRole
to 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
- ThePlayer
making contact.other
- The nativePlayer
being contacted.tile
- An optionalTile
to 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
- ThePlayer
requesting the summary.player
- ThePlayer
to 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
- TheIndianSettlement
to 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
- TheUnit
that is demanding.colony
- TheColony
to demand of.type
- TheGoodsType
to 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
- TheUnit
that will join.colony
- TheColony
to 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
- TheUnit
that 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
- TheLocation
where the goods are.type
- TheGoodsType
to load.amount
- The amount of goods to load.carrier
- TheUnit
to 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
- ThePlayer
that 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
- TheUnit
that 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
- TheUnit
to 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
- TheUnit
to move.destination
- TheLocation
to 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
- TheUnit
delivering the gift.colony
- TheColony
to 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
- TheUnit
that 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
- TheNativeTrade
underway.action
- TheNativeTradeAction
to 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
- TheUnit
that is trading.is
- TheIndianSettlement
that 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
- TheRegion
that is being discovered.tile
- TheTile
where the region is discovered.unit
- TheUnit
discovering 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
- TheGoodsType
to 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
- TheColony
that 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
- TheUnit
to 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
- TheColony
to rearrange.workers
- A list of workerUnit
s that may change.scratch
- A copy of the underlyingColony
with 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
- AFreeColGameObject
to 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
- TheUnit
that 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
- TheUnit
that is speaking.is
- TheIndianSettlement
to 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
- TheNation
to whose availability is to be set.state
- TheNationState
defining 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
- TheNation
to set the color for.color
- TheColor
selected.- 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
- TheUnit
whose 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
- TheUnit
to 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
- TheColony
where the levels are set.data
- TheExportData
setting.- 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
- TheNation
selected.- 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
- TheNationType
selected.- 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
- TheUnit
that is spying.settlement
- TheSettlement
to 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
- TheUnitType
to 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
- TheGoodsType
to unload.amount
- The amount of goods to unload.carrier
- TheUnit
to 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
- TheOptionGroup
containing 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
- TheOptionGroup
containing 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
- TheUnit
to change the workLocation of.workLocation
- TheWorkLocation
to change to.- Returns:
- True if the server interaction succeeded.
-
-