Package net.sf.colossus.server
Class Server
java.lang.Object
java.lang.Thread
net.sf.colossus.server.Server
Class Server lives on the server side and handles all communcation with
the clients. It talks to the server classes locally, and to the Clients
via the network protocol.
- Author:
- David Ripton
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SelectionKey
private final List
<SocketChannel> List of SocketChannels that are currently activeprivate final ByteBuffer
private String
private final List
<ClientHandlerStub> private ClientHandlerStub
private boolean
private final Object
private static Thread
private final Map
<String, Server.WithdrawInfo> ClientHandlers to be withdrawn, together with some related (timing) data; selector thread will do it then when it's the right time for itprivate boolean
private GameServerSide
private int
Timeout how long server waits for clients before giving up; in normal/local games 0, meaning forever; in public server usage set to WEBGAMES_STARTUP_TIMEOUT_SECSprivate final Object
private String
private boolean
Recipients for everything send to "each client" - including the stubprivate boolean
private boolean
private long
How many ms ago last ping round was done.private static final Logger
private boolean
(package private) ClientHandler
private final int
Map of players to their clients.private final int
Server socket port.(package private) ClientHandler
private final List
<ClientHandler> Only real ClientHandlers (excluding the stub)private final MessageRecorder
private final List
<RemoteLogHandler> private Selector
private boolean
Will be set to true after all clients are properly connectedprivate boolean
private ServerSocket
private boolean
private int
private long
When server started to listed for clientsprivate static StartupProgress
private boolean
private int
private CreatureServerSide
private CreatureServerSide
private final int
private final int
private final int
private int
Number of player clients we're waiting for to *connect*private int
Number of player clients we're waiting for to *join* - when last one has joined, then kick of newGame2() or loadGame2()private final Object
private static final int
How long in public server games socket shall wait for Clients.private final Object
Semaphor for synchronized access to waitingForPlayersToJoinprivate final WhatNextManager
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Fields inherited from interface net.sf.colossus.server.IServer
CLIENT_VERSION, CLIENT_VERSION_CAN_HANDLE_NAK, CLIENT_VERSION_CAN_RECONNECT, CLIENT_VERSION_UNDERSTANDS_PING, CLIENT_VERSION_VARIANT_XML_OK, MINIMUM_CLIENT_VERSION
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
acquireAngel
(Legion legion, CreatureType angelType) private void
(package private) String
addClient
(ClientHandler client, String playerName, boolean remote, int clientVersion, String buildInfo, boolean spectator) Add a Client.private void
addRemoteClient
(IClient client, Player player) (package private) void
(package private) void
(package private) void
(package private) void
allInitBattle
(MasterHex masterHex) (package private) void
(package private) void
DO NOT USE: package so that it can be called from Log4J Appender.(package private) void
allPlaceNewChit
(CreatureServerSide critter) (package private) void
(package private) void
allRemoveLegion
(Legion legion) (package private) void
allRequestConfirmCatchup
(String action, boolean skipInTrouble) (package private) void
IF last ping round is at least PING_REQUEST_INTERVAL_SEC seconds ago, then send a ping request to all clients (except those which are in trouble anyway).(package private) void
allRevealCreatures
(Legion legion, List<CreatureType> creatureNames, String reason) (package private) void
allRevealEngagedLegion
(Legion legion, boolean isAttacker, String reason) pass to all clients the 'revealEngagedCreatures' message, then fire an 'revealEvent' to the history.(package private) void
allRevealLegion
(Legion legion, String reason) (package private) void
allRevealLegion
(Legion legion, List<CreatureType> creatures, String reason) Call from History during load game only(package private) void
Hack to set color on load game.(package private) void
(package private) void
(package private) void
(package private) void
(package private) void
(package private) void
(package private) void
(package private) void
(package private) void
Needed if loading game outside the split phase.(package private) void
allSyncOption
(String optname, boolean value) (package private) void
allSyncOption
(String optname, int value) (package private) void
allSyncOption
(String optname, String value) (package private) void
allTellAddCreature
(AddCreatureAction event, boolean updateHistory, String reason) (package private) void
(package private) void
allTellBattleMove
(int tag, BattleHex startingHex, BattleHex endingHex, boolean undo) (package private) void
allTellCarryResults
(CreatureServerSide carryTarget, int carryDamageDone, int carryDamageLeft, Set<String> carryTargetDescriptions) (package private) void
allTellDidMove
(Legion legion, MasterHex startingHex, MasterHex hex, EntrySide entrySide, boolean teleport, CreatureType teleportingLord) (package private) void
allTellDidSplit
(Legion parent, Legion child, int turn, boolean history) Called from game after this legion was split off, or by history(package private) void
allTellDidSummon
(Legion receivingLegion, Legion donorLegion, CreatureType summon) (package private) void
allTellEngagement
(MasterHex hex, Legion attacker, Legion defender) (package private) void
allTellEngagementResults
(Legion winner, String method, int points, int turns) (package private) void
allTellGameOver
(String message, boolean disposeFollows) (package private) void
allTellHexDamageResults
(CreatureServerSide target, int damage) (package private) void
allTellHexSlowResults
(CreatureServerSide target, int slowValue) (package private) void
allTellLegionLocation
(Legion legion) (package private) void
allTellMovementRoll
(int roll) (package private) void
allTellPlayerElim
(Player eliminatedPlayer, Player slayer, boolean updateHistory) (package private) void
allTellRedo
(boolean val) (package private) void
allTellRemoveCreature
(Legion legion, CreatureType creature, boolean updateHistory, String reason) (package private) void
allTellReplay
(boolean val, int maxTurn) (package private) void
allTellStrikeResults
(CreatureServerSide striker, CreatureServerSide target, int strikeNumber, List<String> rolls, int damage, int carryDamageLeft, Set<String> carryTargetDescriptions) void
allTellUndidMove
(Legion legion, MasterHex formerHex, MasterHex currentHex, boolean splitLegionHasForcedMove) (package private) void
allUpdateCreatureCount
(CreatureType type, int count, int deadCount) (package private) void
allUpdatePlayerInfo
(boolean treatDeadAsAlive, String reason) (package private) void
allUpdatePlayerInfo
(String reason) private boolean
(package private) void
appendToConnLogs
(ClientHandler chInTrouble, String message) void
applyCarries
(BattleHex hex) (package private) void
askAcquireAngel
(PlayerServerSide player, Legion legion, List<CreatureType> recruits) Find out if the player wants to acquire an angel or archangel.(package private) void
askChooseStrikePenalty
(SortedSet<PenaltyOption> penaltyOptions) Takes a Set of PenaltyOptions.(package private) void
askConcede
(Legion ally, Legion enemy) Ask ally's player whether he wants to concede with ally.(package private) void
Ask ally's player whether he wants to flee with ally.(package private) void
askPickColor
(Player player, List<PlayerColor> colorsLeft) (package private) void
askPickFirstMarker
(Player player) void
assignColor
(PlayerColor color) void
assignFirstMarker
(String markerId) void
assignStrikePenalty
(String prompt) void
void
void
void
clientWontConfirmCatchup
(ClientHandler ch, String reason) Check whether client is currently expected to send a caught-Up confirmation.private void
Close serverSocket and selector, if neededvoid
void
(package private) void
createSummonAngel
(Legion legion) (package private) void
didRecruit
(AddCreatureAction event, CreatureType recruiter) private void
private void
disconnectChannel
(SocketChannel sc, SelectionKey key) Close the SocketChannel, cancel the selection key and unregister the SocketChannel from list of active SocketChannels.(package private) void
void
doBattleMove
(int tag, BattleHex hex) void
void
doMove
(Legion legion, MasterHex hex, EntrySide entrySide, boolean teleport, CreatureType teleportingLord) void
void
void
void
void
void
void
doNotConcede
(Legion legion) void
void
doRecruit
(Recruitment event) Handle mustering for legion.void
doSetWhatToDoNext
(WhatNextManager.WhatToDoNext whatToDoNext, boolean triggerQuitTimer) void
doSplit
(Legion parent, String childId, List<CreatureType> creaturesToSplit) Executes a split of certain creatures from a legion.void
Handles a summon eventvoid
void
void
Shutdown initiated by outside, i.e.void
void
private PlayerServerSide
private IClient
getClientHandlerByName
(String name) Might be a player or a spectator (but not a stub)getGame()
(package private) int
getIntOption
(String optname) private Player
The player, for which data from socket is currently processed.getPlayerInfo
(boolean treatDeadAsAlive) (package private) String
Name of the player, for which data from socket is currently processed.private void
private void
boolean
Handle GUI-initiated requests: Save and Pauseprivate void
handleOutsideChanges
(boolean wasTimeout, boolean stillWaitingForClients) private int
private void
(package private) void
void
initiateSaveGame
(String filename) (package private) void
private void
initWaitingForPlayersToJoin
(int count) Initialize the number of players we wait for to join (thread-safe)private boolean
returns true if the active player is the player owning the connection from which data is currently processedprivate boolean
boolean
isClientGone
(Player player) private String
Validates that it it OK to be "done with strikes" now for executing playerboolean
isKnownClient
(InetAddress requester) boolean
boolean
void
(package private) void
void
void
void
(package private) void
logToStartLog
(String message) void
makeProposal
(String proposalString) playerName makes a proposal.void
mulligan()
void
newGame()
(package private) void
void
(package private) void
oneRevealLegion
(Legion legion, Player player, String reason) (package private) void
oneRevealLegion
(Player player, Legion legion, List<CreatureType> creatureNames, String reason) Call from History during load game only(package private) void
oneSetOption
(Player player, String optname, boolean value) (package private) void
oneSetOption
(Player player, String optname, String value) (package private) void
othersTellOneHasNetworkTrouble
(ClientHandler chInTrouble) (package private) void
othersTellOnesTroubleIsOver
(ClientHandler chInTrouble) (package private) void
othersTellReconnectCompleted
(ClientHandler chInTrouble) (package private) void
othersTellReconnectOngoing
(ClientHandler chInTrouble) (package private) void
othersTellRemainingTime
(ClientHandler chInTrouble, int secondsLeft) void
overrideProcessingCH
(Player player) private void
(package private) void
Put the ClientHandler into the queue to be removed from selector on next possible opportunity(package private) void
(package private) void
void
void
requestSyncDelta
(int lastReceivedMessageNr, int syncRequestNumber) void
void
run()
void
void
void
void
setBoardVisibility
(Player player, boolean val) void
void
setPauseState
(boolean newState) (package private) void
setPlayerName
(Player player, String newName) Used to change a player name after color is assigned.(package private) void
void
When the last player has *joined* (not just connected), he calls this here, and this will proceed with either loadGame2() or newGame2().void
void
private void
void
void
stopGame()
void
void
(package private) void
tellProposal
(Player player, Proposal proposal) Tell playerName about proposal.(package private) void
private void
triggerWithdrawIfDoesNotReconnect
(long intervalLen, int intervals) (package private) void
twoNegotiate
(Legion attacker, Legion defender) (package private) void
undidRecruit
(Legion legion, CreatureType recruit, boolean reinforced) (package private) void
undidSplit
(Legion splitoff, Legion survivor, boolean updateHistory, int turn) void
undoBattleMove
(BattleHex hex) void
void
undoRecruit
(Legion legion) void
void
unregisterSocketChannel
(SocketChannel socketChannel) (package private) boolean
void
waitOnSelector
(int timeout, boolean stillWaitingForClients) void
void
void
Withdraw the player for which data was currently processed on socket (if it is a real one, and withdrawal still makes sense).void
withdrawFromGame
(String playerName) Withdraw a specific player of which we know only the name; e.g.private void
withdrawFromGameIfRelevant
(Exception gotException, boolean didDisconnect) Something with the connection of "processingCH" which makes perhaps Withdraw necessary.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
LOGGER
-
startLog
-
game
-
whatNextManager
-
recorder
-
clientStub
-
iClients
Recipients for everything send to "each client" - including the stub -
realClients
Only real ClientHandlers (excluding the stub) -
remoteClients
-
remoteLogHandlers
-
playerToClientMap
Map of players to their clients. -
activeSocketChannelList
List of SocketChannels that are currently active -
forcedWithdraws
ClientHandlers to be withdrawn, together with some related (timing) data; selector thread will do it then when it's the right time for it -
waitingForClients
private int waitingForClientsNumber of player clients we're waiting for to *connect* -
waitingForPlayersToJoin
private int waitingForPlayersToJoinNumber of player clients we're waiting for to *join* - when last one has joined, then kick of newGame2() or loadGame2() -
wfptjSemaphor
Semaphor for synchronized access to waitingForPlayersToJoin -
sendPingRequests
private boolean sendPingRequestsWill be set to true after all clients are properly connected -
spectators
private int spectators -
port
private final int portServer socket port. -
striker
-
target
-
strikeNumber
private int strikeNumber -
rolls
-
serverSocket
-
selector
-
acceptKey
-
stopAcceptingFlag
private boolean stopAcceptingFlag -
guiRequestMutex
-
guiRequestSaveFlag
private boolean guiRequestSaveFlag -
guiRequestSaveFilename
-
inPauseState
private boolean inPauseState -
fileServerThread
-
serverRunning
private boolean serverRunning -
obsolete
private boolean obsolete -
shuttingDown
private boolean shuttingDown -
forceShutDown
private boolean forceShutDown -
initiateDisposal
private boolean initiateDisposal -
caughtUpAction
-
timeoutDuringStart
private final int timeoutDuringStart- See Also:
-
timeoutDuringGame
private final int timeoutDuringGame- See Also:
-
timeoutDuringShutdown
private final int timeoutDuringShutdown- See Also:
-
WEBGAMES_STARTUP_TIMEOUT_SECS
private static final int WEBGAMES_STARTUP_TIMEOUT_SECSHow long in public server games socket shall wait for Clients.- See Also:
-
PING_REQUEST_INTERVAL_SEC
private final int PING_REQUEST_INTERVAL_SEC- See Also:
-
lastPingRound
private long lastPingRoundHow many ms ago last ping round was done. -
startInititatedTime
private long startInititatedTimeWhen server started to listed for clients -
gameStartupTimeoutSecs
private int gameStartupTimeoutSecsTimeout how long server waits for clients before giving up; in normal/local games 0, meaning forever; in public server usage set to WEBGAMES_STARTUP_TIMEOUT_SECS -
disposeAllClientsDoneMutex
-
disposeAllClientsDone
private boolean disposeAllClientsDone -
byteBuffer
-
processingCH
ClientHandler processingCH -
overriddenCH
ClientHandler overriddenCH -
channelChanges
-
waitUntilOverMutex
-
waitingToCatchup
-
-
Constructor Details
-
Server
Server(GameServerSide game, WhatNextManager whatNextMgr, int port)
-
-
Method Details
-
run
public void run() -
initFileServer
void initFileServer() -
startFileServerIfNotRunning
void startFileServerIfNotRunning() -
isKnownClient
-
initSocketServer
void initSocketServer() -
waitForClients
boolean waitForClients() -
createClientHandlerStub
public void createClientHandlerStub() -
overrideProcessingCH
-
restoreProcessingCH
public void restoreProcessingCH() -
waitOnSelector
public void waitOnSelector(int timeout, boolean stillWaitingForClients) -
handleForcedWithdraws
private void handleForcedWithdraws() -
handleOutsideChanges
private void handleOutsideChanges(boolean wasTimeout, boolean stillWaitingForClients) -
handleSelectedKeys
- Throws:
IOException
ClosedChannelException
-
handleChannelChanges
- Throws:
IOException
-
externShutdown
public void externShutdown()Shutdown initiated by outside, i.e. NOT by the Server thread itself. Right now, this is used by StartupProgressDialog's abort button. -
stopAccepting
- Throws:
IOException
-
closeSocketAndSelector
private void closeSocketAndSelector()Close serverSocket and selector, if needed -
handleReadFromChannel
- Throws:
IOException
-
processByteBuffer
private void processByteBuffer() -
withdrawFromGameIfRelevant
Something with the connection of "processingCH" which makes perhaps Withdraw necessary. If client seems to support reconnect, mark CH to be temp. disconnected, otherwise take care of the proper withdrawal.- Parameters:
gotException
- An exception, if calling this was caused by an (IO)Exception, otherwise null, i.e. it was triggered by EOF.didDisconnect
- whether an explicit dicsonnect request message had been received already from that client ( = no point to wait for reconnect attempt).
-
triggerWithdrawIfDoesNotReconnect
private void triggerWithdrawIfDoesNotReconnect(long intervalLen, int intervals) -
queueClientHandlerForChannelChanges
Put the ClientHandler into the queue to be removed from selector on next possible opportunity -
notifyThatGameFinished
public void notifyThatGameFinished() -
waitUntilGameFinishes
public void waitUntilGameFinishes() -
stopServerRunning
public void stopServerRunning() -
isServerRunning
public boolean isServerRunning() -
stopFileServer
public void stopFileServer() -
disconnectChannel
Close the SocketChannel, cancel the selection key and unregister the SocketChannel from list of active SocketChannels.- Parameters:
sc
- SocketChannel of the clientkey
- Key for that SocketChannel- Throws:
IOException
-
unregisterSocketChannel
-
setBoardVisibility
-
isClientGone
-
anyNonAiSocketsLeft
private boolean anyNonAiSocketsLeft() -
setObsolete
public void setObsolete() -
getPlayerName
String getPlayerName()Name of the player, for which data from socket is currently processed. -
getPlayer
The player, for which data from socket is currently processed. -
getClientHandlerByName
Might be a player or a spectator (but not a stub)- Parameters:
name
- Name of the player/client/spectator for which ClientHandler is needed
-
isActivePlayer
private boolean isActivePlayer()returns true if the active player is the player owning the connection from which data is currently processed -
getActivePlayerSS
-
isBattleActivePlayer
private boolean isBattleActivePlayer() -
addClient
String addClient(ClientHandler client, String playerName, boolean remote, int clientVersion, String buildInfo, boolean spectator) Add a Client.- Parameters:
client
-playerName
-remote
-clientVersion
-spectator
-- Returns:
- Reason why adding Client was refused, null if all is fine.
-
startGame
public void startGame()When the last player has *joined* (not just connected), he calls this here, and this will proceed with either loadGame2() or newGame2(). -
initWaitingForPlayersToJoin
private void initWaitingForPlayersToJoin(int count) Initialize the number of players we wait for to join (thread-safe)- Parameters:
count
- the number of players that are expected to join
-
addRemoteClient
-
disposeAllClients
void disposeAllClients() -
loadFailed
public void loadFailed() -
cleanupStartlog
public void cleanupStartlog() -
doCleanup
public void doCleanup() -
allUpdatePlayerInfo
-
allUpdatePlayerInfo
-
allUpdateCreatureCount
-
allTellMovementRoll
void allTellMovementRoll(int roll) -
leaveCarryMode
public void leaveCarryMode()- Specified by:
leaveCarryMode
in interfaceIServer
-
doneWithBattleMoves
public void doneWithBattleMoves()- Specified by:
doneWithBattleMoves
in interfaceIServer
-
doneWithStrikes
public void doneWithStrikes()- Specified by:
doneWithStrikes
in interfaceIServer
-
isDoneWithStrikesOk
Validates that it it OK to be "done with strikes" now for executing player- Returns:
- reason why it's not OK; null if all is ok
-
getClient
-
allInitBoard
void allInitBoard() -
allTellReplay
void allTellReplay(boolean val, int maxTurn) -
allTellRedo
void allTellRedo(boolean val) -
allRequestConfirmCatchup
-
allTellAllLegionLocations
void allTellAllLegionLocations() -
allTellLegionLocation
-
allRemoveLegion
-
allTellPlayerElim
-
repeatTellOneHasNetworkTrouble
void repeatTellOneHasNetworkTrouble() -
othersTellOneHasNetworkTrouble
-
othersTellOnesTroubleIsOver
-
othersTellReconnectOngoing
-
othersTellRemainingTime
-
othersTellReconnectCompleted
-
appendToConnLogs
-
allRequestPingIfNeeded
void allRequestPingIfNeeded()IF last ping round is at least PING_REQUEST_INTERVAL_SEC seconds ago, then send a ping request to all clients (except those which are in trouble anyway). -
allTellGameOver
-
allSetupTurnState
void allSetupTurnState()Needed if loading game outside the split phase. -
allSetupSplit
void allSetupSplit() -
allSetupMove
void allSetupMove() -
allSetupFight
void allSetupFight() -
allSetupMuster
void allSetupMuster() -
kickPhase
void kickPhase() -
allSetupBattleSummon
void allSetupBattleSummon() -
allSetupBattleRecruit
void allSetupBattleRecruit() -
allSetupBattleMove
void allSetupBattleMove() -
allSetupBattleFight
void allSetupBattleFight() -
allPlaceNewChit
-
allRemoveDeadBattleChits
void allRemoveDeadBattleChits() -
allTellEngagementResults
-
nextEngagement
void nextEngagement() -
askAcquireAngel
Find out if the player wants to acquire an angel or archangel. -
acquireAngel
- Specified by:
acquireAngel
in interfaceIServer
-
createSummonAngel
-
reinforce
-
doSummon
Description copied from interface:IServer
Handles a summon event -
doRecruit
Handle mustering for legion. if recruiting with nothing, recruiterName is a non-null String that contains "null". -
didRecruit
-
undidRecruit
-
engage
-
allTellEngagement
-
askConcede
Ask ally's player whether he wants to concede with ally. -
concede
-
doNotConcede
- Specified by:
doNotConcede
in interfaceIServer
-
askFlee
Ask ally's player whether he wants to flee with ally. -
flee
-
doNotFlee
-
twoNegotiate
-
makeProposal
playerName makes a proposal.- Specified by:
makeProposal
in interfaceIServer
-
tellProposal
Tell playerName about proposal. -
fight
-
doBattleMove
- Specified by:
doBattleMove
in interfaceIServer
-
allTellBattleMove
-
strike
-
applyCarries
- Specified by:
applyCarries
in interfaceIServer
-
undoBattleMove
- Specified by:
undoBattleMove
in interfaceIServer
-
allTellStrikeResults
void allTellStrikeResults(CreatureServerSide striker, CreatureServerSide target, int strikeNumber, List<String> rolls, int damage, int carryDamageLeft, Set<String> carryTargetDescriptions) -
allTellCarryResults
void allTellCarryResults(CreatureServerSide carryTarget, int carryDamageDone, int carryDamageLeft, Set<String> carryTargetDescriptions) -
allTellHexSlowResults
-
allTellHexDamageResults
-
askChooseStrikePenalty
Takes a Set of PenaltyOptions. -
assignStrikePenalty
- Specified by:
assignStrikePenalty
in interfaceIServer
-
allInitBattle
-
allCleanupBattle
void allCleanupBattle() -
mulligan
public void mulligan() -
undoSplit
-
undidSplit
-
undoMove
-
allTellUndidMove
-
undoRecruit
- Specified by:
undoRecruit
in interfaceIServer
-
doneWithSplits
public void doneWithSplits()- Specified by:
doneWithSplits
in interfaceIServer
-
doneWithMoves
public void doneWithMoves()- Specified by:
doneWithMoves
in interfaceIServer
-
doneWithEngagements
public void doneWithEngagements()- Specified by:
doneWithEngagements
in interfaceIServer
-
doneWithRecruits
public void doneWithRecruits()- Specified by:
doneWithRecruits
in interfaceIServer
-
isWithdrawalIrrelevant
public boolean isWithdrawalIrrelevant() -
withdrawFromGame
public void withdrawFromGame()Withdraw the player for which data was currently processed on socket (if it is a real one, and withdrawal still makes sense).- Specified by:
withdrawFromGame
in interfaceIServer
-
withdrawFromGame
Withdraw a specific player of which we know only the name; e.g. when one clientHandler when trying to write to another clientHandler encountered closed socket.- Parameters:
playerName
- Name of the player to withdraw
-
sendDisconnect
public void sendDisconnect()- Specified by:
sendDisconnect
in interfaceIServer
-
stopGame
public void stopGame() -
triggerDispose
void triggerDispose() -
getPlayerInfo
-
doSplit
Description copied from interface:IServer
Executes a split of certain creatures from a legion. -
allTellDidSplit
Called from game after this legion was split off, or by history -
doMove
public void doMove(Legion legion, MasterHex hex, EntrySide entrySide, boolean teleport, CreatureType teleportingLord) -
allTellDidMove
void allTellDidMove(Legion legion, MasterHex startingHex, MasterHex hex, EntrySide entrySide, boolean teleport, CreatureType teleportingLord) -
allTellDidSummon
-
allTellAddCreature
-
allTellRemoveCreature
void allTellRemoveCreature(Legion legion, CreatureType creature, boolean updateHistory, String reason) -
allRevealLegion
-
allRevealEngagedLegion
pass to all clients the 'revealEngagedCreatures' message, then fire an 'revealEvent' to the history.- Parameters:
legion
- the legion marker to reveal which is in a battleisAttacker
- true if the 'legion' is the atackker in the battle, false for the defender.
-
allRevealLegion
Call from History during load game only -
oneRevealLegion
-
oneRevealLegion
Call from History during load game only -
allFullyUpdateLegionStatus
void allFullyUpdateLegionStatus() -
allFullyUpdateAllLegionContents
-
allRevealCreatures
-
newGame
public void newGame() -
loadGame
-
saveGame
-
saveGame
-
initiateSaveGame
-
setPauseState
public void setPauseState(boolean newState) -
handleGuiRequests
public boolean handleGuiRequests()Handle GUI-initiated requests: Save and Pause- Returns:
- true if it did something (saving the game)
-
checkServerConnection
public void checkServerConnection()- Specified by:
checkServerConnection
in interfaceIServer
-
clientWontConfirmCatchup
Check whether client is currently expected to send a caught-Up confirmation. If yes: it won't happen, so act accordingly. If no : even better so, so just do nothing.- Parameters:
reason
- Reason why client won't send the confirmation (typically disconnected or something).
-
clientConfirmedCatchup
public void clientConfirmedCatchup()- Specified by:
clientConfirmedCatchup
in interfaceIServer
-
actOnAllCaughtUp
private void actOnAllCaughtUp() -
setPlayerName
Used to change a player name after color is assigned. -
askPickColor
-
assignColor
- Specified by:
assignColor
in interfaceIServer
-
askPickFirstMarker
-
assignFirstMarker
- Specified by:
assignFirstMarker
in interfaceIServer
-
allSetColor
void allSetColor()Hack to set color on load game. -
getIntOption
-
oneSetOption
-
oneSetOption
-
allSyncOption
-
allSyncOption
-
allSyncOption
-
allLog
DO NOT USE: package so that it can be called from Log4J Appender. -
logToStartLog
-
disableAutoCloseStartupLog
private void disableAutoCloseStartupLog() -
doSetWhatToDoNext
-
startupProgressAbort
public void startupProgressAbort() -
startupProgressQuit
public void startupProgressQuit() -
getGame
-
getRecorder
-
replyToRequestGameInfo
public void replyToRequestGameInfo() -
requestSyncDelta
public void requestSyncDelta(int lastReceivedMessageNr, int syncRequestNumber) -
joinGame
-
watchGame
public void watchGame() -
enforcedDisconnectClient
-