Package net.sf.freecol
Class FreeCol
- java.lang.Object
-
- net.sf.freecol.FreeCol
-
public final class FreeCol extends java.lang.ObjectThis class is responsible for handling the command-line arguments and starting either the stand-alone server or the client-GUI.- See Also:
FreeColClient,FreeColServer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classFreeCol.LogLevelThe levels of logging in this game.
-
Field Summary
Fields Modifier and Type Field Description private static NationOptions.AdvantagesadvantagesThe type of advantages.private static NationOptions.AdvantagesADVANTAGES_DEFAULTprivate static java.lang.StringargDirDefinitions for all the options.private static java.lang.StringargFileprivate static booleancheckIntegritystatic java.lang.StringCLIENT_THREADprivate static booleanconsoleLoggingprivate static booleandebugStartprivate static java.lang.String[]DIFFICULTIESThe difficulty levels.private static java.lang.StringdifficultyThe difficulty level id.private static java.lang.StringDIFFICULTY_DEFAULTprivate static inteuropeanCountThe number of European nations to enable by default.private static intEUROPEANS_DEFAULTprivate static intEUROPEANS_MINprivate static booleanfastStartprivate static java.lang.StringfontNameA font override.static java.lang.StringFREECOL_MAP_EXTENSIONThe extension for FreeCol maps.private static java.lang.StringFREECOL_PROTOCOL_VERSIONThe FreeCol protocol version number.static java.lang.StringFREECOL_SAVE_EXTENSIONThe extension for FreeCol saved games.private static java.lang.StringFREECOL_VERSIONThe FreeCol release version number.private static java.lang.StringfreeColRevisionSpecific revision number (currently the git tag of trunk at release)static floatGUI_SCALE_DEFAULTstatic floatGUI_SCALE_MAXprivate static intGUI_SCALE_MAX_PCTstatic floatGUI_SCALE_MINprivate static intGUI_SCALE_MIN_PCTstatic floatGUI_SCALE_STEPprivate static intGUI_SCALE_STEP_PCTprivate static booleanheadlessprivate static booleanintroVideoprivate static java.lang.StringJAVA_VERSIONThe Java version.private static java.lang.StringJAVA_VERSION_MINprivate static booleanjavaCheckprivate static java.util.LocalelocaleThe locale, either default or command-line specified.private static java.util.logging.Loggerloggerprivate static java.util.logging.LevelLOGLEVEL_DEFAULTprivate static java.util.List<FreeCol.LogLevel>logLevelsprivate static longMEGAprivate static longMEMORY_MAXThe maximum available memory.private static longMEMORY_MINprivate static booleanmemoryCheckprivate static java.lang.StringMETA_SERVER_ADDRESSprivate static intMETA_SERVER_PORTstatic java.lang.StringMETASERVER_THREADprivate static java.lang.StringmetaServerAddressMeta-server location.private static intmetaServerPortprivate static java.lang.StringnameThe client player name.private static java.lang.String[][]optionsTableprivate static intPORT_DEFAULTprivate static booleanpublicServerstatic java.lang.StringSERVER_THREADprivate static java.net.InetAddressserverAddressHow to name and configure the server.private static java.lang.StringserverNameprivate static intserverPortprivate static booleansoundprivate static java.util.Map<java.lang.String,java.lang.String>specialOptionsThe special client options that must be processed early.private static java.lang.StringSPLASH_DEFAULTprivate static java.io.InputStreamsplashStreamA stream to get the splash image from.private static booleanstandAloneServerprivate static java.lang.StringtcThe TotalConversion / ruleset in play, defaults to "freecol".private static java.lang.StringTC_DEFAULTprivate static longtimeoutThe time out (seconds) for otherwise blocking commands.static longTIMEOUT_DEFAULTstatic longTIMEOUT_MAXstatic longTIMEOUT_MINprivate static java.awt.DimensionwindowSizeThe size of window to create, defaults to impossible dimensions to require windowed mode with best determined screen size.private static java.awt.DimensionWINDOWSIZE_FALLBACK
-
Constructor Summary
Constructors Modifier Constructor Description privateFreeCol()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringTemplatebadFile(java.lang.String messageId, java.io.File file)Generate a failure message depending on a file parameter.private static voidcheckServerIntegrity(FreeColServer freeColServer)Check the integrity of a FreeCol server.private static SplashScreencreateSplashScreen()static StringTemplateerrorFromException(java.lang.Exception ex, java.lang.String fallbackKey)Build an error template from an exception.static StringTemplateerrorFromException(java.lang.Exception ex, StringTemplate fallback)Build an error template from an exception.private static voidfatal(java.lang.String err)Exit printing fatal error message.static voidfatal(java.util.logging.Logger logger, java.lang.String err)Quit and exit with an error.private static voidfatal(StringTemplate template)Exit printing fatal error message.private static java.lang.StringfindArg(java.lang.String option, java.lang.String[] args)Find an option before the real option handling can get started.static NationOptions.AdvantagesgetAdvantages()Gets the default advantages type.private static java.lang.StringgetAdvantagesDescription()Get a description for the advantages argument.static java.lang.StringBuildergetConfiguration()We get a lot of lame bug reports with insufficient configuration information.private static java.lang.StringgetDebugDescription()Get a description for the debug argument.private static java.io.InputStreamgetDefaultSplashStream(java.net.JarURLConnection juc)Get a stream for the default splash file.static java.lang.StringgetDifficulty()Gets the difficulty level.static intgetEuropeanCount()Get the number of European nations to enable by default.static java.lang.StringgetFreeColProtocolVersion()Gets the current version of the FreeCol protocol.static booleangetHeadless()Are we in headless mode, either externally true or explicitly from the command line.private static java.net.JarURLConnectiongetJarURLConnection(java.lang.Class c)Get the JarURLConnection from a class.static java.util.LocalegetLocale()Get the selected locale.static java.lang.StringgetMetaServerAddress()Get the meta-server address.static intgetMetaServerPort()Get the meta-server port.static java.lang.StringgetName()Gets the user name.static java.lang.StringgetRevision()Gets the current revision of game.static java.lang.StringgetServerHost()Get the default server host name.static java.net.InetAddressgetServerName()Gets the server address.static intgetServerPort()Gets the server network port.static java.lang.StringgetTC()Gets the current Total-Conversion.static FreeColTcFilegetTCFile()Gets the FreeColTcFile for the current TC.private static SpecificationgetTCSpecification()Get the specification from the specified TC.static longgetTimeout(boolean singlePlayer)Gets the timeout.private static java.lang.StringgetValidAdvantages()Gets a comma separated list of localized advantage type names.static java.lang.StringgetValidDifficulties()Gets the names of the valid difficulty levels.static java.lang.StringgetValidGUIScales()Gets the valid scale factors for the GUI.static java.lang.StringgetVersion()Gets the current version of game.private static voidgripe(java.lang.String key)Just gripe to System.err.private static voidgripe(StringTemplate template)Just gripe to System.err.private static voidhandleArgs(java.lang.String[] args)Processes the command-line arguments and takes appropriate actions for each of them.static SpecificationloadSpecification(FreeColTcFile tcf, NationOptions.Advantages advantages, java.lang.String difficulty)Get the specification from a given TC file.static voidmain(java.lang.String[] args)The entrypoint.private static voidprintUsage(org.apache.commons.cli.Options options, int status)Prints the usage message and exits.private static voidprocessSpecialOptions()Handle the special options that need to be processed early.static voidquit(int status)Quit FreeCol.private static java.lang.StringreadVersion(java.net.JarURLConnection juc)Extract the package version from the class.private static NationOptions.AdvantagesselectAdvantages(java.lang.String as)Sets the advantages type.private static java.lang.StringselectDifficulty(java.lang.String arg)Selects a difficulty level.private static intselectEuropeanCount(java.lang.String arg)Selects a European nation count.static voidsetAdvantages(NationOptions.Advantages advantages)Sets the advantages type.static voidsetDifficulty(java.lang.String difficulty)Sets the difficulty level.static voidsetDifficulty(OptionGroup difficulty)Sets the difficulty level.static voidsetEuropeanCount(int n)Sets the number of enabled European nations.static voidsetHeadless(boolean newHeadless)Set the headless state.static booleansetLocale(java.lang.String localeArg)Set the locale.private static booleansetMetaServer(java.lang.String arg)Set the meta-server location.static voidsetName(java.lang.String name)Sets the user name.private static booleansetServerAddress(java.lang.String arg)Sets the server address.private static booleansetServerPort(java.lang.String arg)Sets the server port.static voidsetTC(java.lang.String tc)Sets the Total-Conversion.static voidsetTimeout(java.lang.String timeout)Sets the timeout.private static voidsetWindowSize(java.lang.String arg)Sets the window size.private static voidstartClient()Start a client.private static voidstartServer()Start the server.static FreeColClientstartTestClient(Specification spec)Wrapper for the test suite to start a test client.static voidtrace(java.util.logging.Logger logger, java.lang.String warn)Log a warning with a stack trace.
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
FREECOL_VERSION
private static final java.lang.String FREECOL_VERSION
The FreeCol release version number.- See Also:
- Constant Field Values
-
FREECOL_PROTOCOL_VERSION
private static final java.lang.String FREECOL_PROTOCOL_VERSION
The FreeCol protocol version number.- See Also:
- Constant Field Values
-
DIFFICULTIES
private static final java.lang.String[] DIFFICULTIES
The difficulty levels.
-
FREECOL_SAVE_EXTENSION
public static final java.lang.String FREECOL_SAVE_EXTENSION
The extension for FreeCol saved games.- See Also:
- Constant Field Values
-
FREECOL_MAP_EXTENSION
public static final java.lang.String FREECOL_MAP_EXTENSION
The extension for FreeCol maps.- See Also:
- Constant Field Values
-
JAVA_VERSION
private static final java.lang.String JAVA_VERSION
The Java version.
-
MEMORY_MAX
private static final long MEMORY_MAX
The maximum available memory.
-
MEGA
private static final long MEGA
- See Also:
- Constant Field Values
-
CLIENT_THREAD
public static final java.lang.String CLIENT_THREAD
- See Also:
- Constant Field Values
-
SERVER_THREAD
public static final java.lang.String SERVER_THREAD
- See Also:
- Constant Field Values
-
METASERVER_THREAD
public static final java.lang.String METASERVER_THREAD
- See Also:
- Constant Field Values
-
freeColRevision
private static java.lang.String freeColRevision
Specific revision number (currently the git tag of trunk at release)
-
locale
private static java.util.Locale locale
The locale, either default or command-line specified.
-
ADVANTAGES_DEFAULT
private static final NationOptions.Advantages ADVANTAGES_DEFAULT
-
DIFFICULTY_DEFAULT
private static final java.lang.String DIFFICULTY_DEFAULT
- See Also:
- Constant Field Values
-
EUROPEANS_DEFAULT
private static final int EUROPEANS_DEFAULT
- See Also:
- Constant Field Values
-
EUROPEANS_MIN
private static final int EUROPEANS_MIN
- See Also:
- Constant Field Values
-
GUI_SCALE_DEFAULT
public static final float GUI_SCALE_DEFAULT
- See Also:
- Constant Field Values
-
GUI_SCALE_MIN_PCT
private static final int GUI_SCALE_MIN_PCT
- See Also:
- Constant Field Values
-
GUI_SCALE_MAX_PCT
private static final int GUI_SCALE_MAX_PCT
- See Also:
- Constant Field Values
-
GUI_SCALE_MIN
public static final float GUI_SCALE_MIN
- See Also:
- Constant Field Values
-
GUI_SCALE_MAX
public static final float GUI_SCALE_MAX
- See Also:
- Constant Field Values
-
GUI_SCALE_STEP_PCT
private static final int GUI_SCALE_STEP_PCT
- See Also:
- Constant Field Values
-
GUI_SCALE_STEP
public static final float GUI_SCALE_STEP
- See Also:
- Constant Field Values
-
LOGLEVEL_DEFAULT
private static final java.util.logging.Level LOGLEVEL_DEFAULT
-
JAVA_VERSION_MIN
private static final java.lang.String JAVA_VERSION_MIN
- See Also:
- Constant Field Values
-
MEMORY_MIN
private static final long MEMORY_MIN
- See Also:
- Constant Field Values
-
META_SERVER_ADDRESS
private static final java.lang.String META_SERVER_ADDRESS
- See Also:
- Constant Field Values
-
META_SERVER_PORT
private static final int META_SERVER_PORT
- See Also:
- Constant Field Values
-
PORT_DEFAULT
private static final int PORT_DEFAULT
- See Also:
- Constant Field Values
-
SPLASH_DEFAULT
private static final java.lang.String SPLASH_DEFAULT
- See Also:
- Constant Field Values
-
TC_DEFAULT
private static final java.lang.String TC_DEFAULT
- See Also:
- Constant Field Values
-
TIMEOUT_DEFAULT
public static final long TIMEOUT_DEFAULT
- See Also:
- Constant Field Values
-
TIMEOUT_MIN
public static final long TIMEOUT_MIN
- See Also:
- Constant Field Values
-
TIMEOUT_MAX
public static final long TIMEOUT_MAX
- See Also:
- Constant Field Values
-
WINDOWSIZE_FALLBACK
private static final java.awt.Dimension WINDOWSIZE_FALLBACK
-
checkIntegrity
private static boolean checkIntegrity
-
consoleLogging
private static boolean consoleLogging
-
debugStart
private static boolean debugStart
-
fastStart
private static boolean fastStart
-
headless
private static boolean headless
-
introVideo
private static boolean introVideo
-
javaCheck
private static boolean javaCheck
-
memoryCheck
private static boolean memoryCheck
-
publicServer
private static boolean publicServer
-
sound
private static boolean sound
-
standAloneServer
private static boolean standAloneServer
-
advantages
private static NationOptions.Advantages advantages
The type of advantages.
-
difficulty
private static java.lang.String difficulty
The difficulty level id.
-
europeanCount
private static int europeanCount
The number of European nations to enable by default.
-
fontName
private static java.lang.String fontName
A font override.
-
logLevels
private static final java.util.List<FreeCol.LogLevel> logLevels
-
metaServerAddress
private static java.lang.String metaServerAddress
Meta-server location.
-
metaServerPort
private static int metaServerPort
-
name
private static java.lang.String name
The client player name.
-
serverAddress
private static java.net.InetAddress serverAddress
How to name and configure the server.
-
serverPort
private static int serverPort
-
serverName
private static java.lang.String serverName
-
splashStream
private static java.io.InputStream splashStream
A stream to get the splash image from.
-
tc
private static java.lang.String tc
The TotalConversion / ruleset in play, defaults to "freecol".
-
timeout
private static long timeout
The time out (seconds) for otherwise blocking commands.
-
windowSize
private static java.awt.Dimension windowSize
The size of window to create, defaults to impossible dimensions to require windowed mode with best determined screen size.
-
specialOptions
private static java.util.Map<java.lang.String,java.lang.String> specialOptions
The special client options that must be processed early.
-
argDir
private static java.lang.String argDir
Definitions for all the options.
-
argFile
private static java.lang.String argFile
-
optionsTable
private static java.lang.String[][] optionsTable
-
-
Method Detail
-
main
public static void main(java.lang.String[] args)
The entrypoint.- Parameters:
args- The command-line arguments.
-
processSpecialOptions
private static void processSpecialOptions()
Handle the special options that need to be processed early.
-
getJarURLConnection
private static java.net.JarURLConnection getJarURLConnection(java.lang.Class c) throws java.io.IOExceptionGet the JarURLConnection from a class.- Parameters:
c- TheClassto get the connection for.- Returns:
- The
JarURLConnection. - Throws:
java.io.IOException- if the connection fails to open.
-
readVersion
private static java.lang.String readVersion(java.net.JarURLConnection juc) throws java.io.IOExceptionExtract the package version from the class.- Parameters:
juc- TheJarURLConnectionto extract from.- Returns:
- A value of the package version attribute.
- Throws:
java.io.IOException- if the manifest is not available.
-
getDefaultSplashStream
private static java.io.InputStream getDefaultSplashStream(java.net.JarURLConnection juc) throws java.io.IOExceptionGet a stream for the default splash file. Note: Not bothering to check for nulls as this is called in try block that ignores all exceptions.- Parameters:
juc- TheJarURLConnectionto extract from.- Returns:
- A suitable
InputStream, or null on error. - Throws:
java.io.IOException- if the connection fails to open.
-
quit
public static void quit(int status)
Quit FreeCol. Route all exits through here.- Parameters:
status- Exit status.
-
fatal
public static void fatal(java.util.logging.Logger logger, java.lang.String err)Quit and exit with an error.- Parameters:
logger- An optionalLoggerto log to.err- The error message.
-
fatal
private static void fatal(StringTemplate template)
Exit printing fatal error message.- Parameters:
template- AStringTemplateto print.
-
fatal
private static void fatal(java.lang.String err)
Exit printing fatal error message.- Parameters:
err- The error message to print.
-
gripe
private static void gripe(StringTemplate template)
Just gripe to System.err.- Parameters:
template- AStringTemplateto print.
-
gripe
private static void gripe(java.lang.String key)
Just gripe to System.err.- Parameters:
key- A message key.
-
trace
public static void trace(java.util.logging.Logger logger, java.lang.String warn)Log a warning with a stack trace.- Parameters:
logger- TheLoggerto log to.warn- The warning message.
-
findArg
private static java.lang.String findArg(java.lang.String option, java.lang.String[] args)Find an option before the real option handling can get started. Takes care to use the *last* instance.- Parameters:
option- The option to find.args- The command-line arguments.- Returns:
- The option's parameter.
-
handleArgs
private static void handleArgs(java.lang.String[] args)
Processes the command-line arguments and takes appropriate actions for each of them.- Parameters:
args- The command-line arguments.
-
printUsage
private static void printUsage(org.apache.commons.cli.Options options, int status)Prints the usage message and exits.- Parameters:
options- The command lineOptions.status- The status to exit with.
-
loadSpecification
public static Specification loadSpecification(FreeColTcFile tcf, NationOptions.Advantages advantages, java.lang.String difficulty)
Get the specification from a given TC file.- Parameters:
tcf- TheFreeColTcFileto load.advantages- An optionalAdvantagessetting.difficulty- An optional difficulty level.- Returns:
- A
Specification.
-
getTCSpecification
private static Specification getTCSpecification()
Get the specification from the specified TC.- Returns:
- A
Specification, quits on error.
-
getHeadless
public static boolean getHeadless()
Are we in headless mode, either externally true or explicitly from the command line.- Returns:
- True if in headless mode.
-
setHeadless
public static void setHeadless(boolean newHeadless)
Set the headless state. Used by the test suite.- Parameters:
newHeadless- The new headless state.
-
getAdvantages
public static NationOptions.Advantages getAdvantages()
Gets the default advantages type.- Returns:
- Usually Advantages.SELECTABLE, but can be overridden at the command line.
-
selectAdvantages
private static NationOptions.Advantages selectAdvantages(java.lang.String as)
Sets the advantages type. Called from NewPanel when a selection is made.- Parameters:
as- The name of the new advantages type.- Returns:
- The type of advantages set, or null if none.
-
setAdvantages
public static void setAdvantages(NationOptions.Advantages advantages)
Sets the advantages type.- Parameters:
advantages- The newAdvantagestype.
-
getValidAdvantages
private static java.lang.String getValidAdvantages()
Gets a comma separated list of localized advantage type names.- Returns:
- A list of advantage types.
-
getAdvantagesDescription
private static java.lang.String getAdvantagesDescription()
Get a description for the advantages argument.- Returns:
- A suitable description.
-
getDebugDescription
private static java.lang.String getDebugDescription()
Get a description for the debug argument.- Returns:
- A suitable description.
-
getDifficulty
public static java.lang.String getDifficulty()
Gets the difficulty level.- Returns:
- The name of a difficulty level.
-
selectDifficulty
private static java.lang.String selectDifficulty(java.lang.String arg)
Selects a difficulty level.- Parameters:
arg- The supplied difficulty argument.- Returns:
- The name of the selected difficulty, or null if none.
-
setDifficulty
public static void setDifficulty(OptionGroup difficulty)
Sets the difficulty level.- Parameters:
difficulty- The actualOptionGroupcontaining the difficulty level.
-
setDifficulty
public static void setDifficulty(java.lang.String difficulty)
Sets the difficulty level.- Parameters:
difficulty- The new difficulty.
-
getValidDifficulties
public static java.lang.String getValidDifficulties()
Gets the names of the valid difficulty levels.- Returns:
- The valid difficulty levels, comma separated.
-
getEuropeanCount
public static int getEuropeanCount()
Get the number of European nations to enable by default.- Returns:
- The default European nation count.
-
setEuropeanCount
public static void setEuropeanCount(int n)
Sets the number of enabled European nations.- Parameters:
n- The number of nations to enable.
-
getValidGUIScales
public static java.lang.String getValidGUIScales()
Gets the valid scale factors for the GUI.- Returns:
- A string containing these.
-
selectEuropeanCount
private static int selectEuropeanCount(java.lang.String arg)
Selects a European nation count.- Parameters:
arg- The supplied count argument.- Returns:
- A valid nation number, or negative on error.
-
getMetaServerAddress
public static java.lang.String getMetaServerAddress()
Get the meta-server address.- Returns:
- The current meta-server address.
-
getMetaServerPort
public static int getMetaServerPort()
Get the meta-server port.- Returns:
- The current meta-server port.
-
setMetaServer
private static boolean setMetaServer(java.lang.String arg)
Set the meta-server location.- Parameters:
arg- The new meta-server location in HOST:PORT format.- Returns:
- True if the location was set.
-
getName
public static java.lang.String getName()
Gets the user name.- Returns:
- The user name, defaults to the user.name property, then to the "main.defaultPlayerName" message value.
-
setName
public static void setName(java.lang.String name)
Sets the user name.- Parameters:
name- The new user name.
-
getLocale
public static java.util.Locale getLocale()
Get the selected locale.- Returns:
- The
Localecurrently in use.
-
setLocale
public static boolean setLocale(java.lang.String localeArg)
Set the locale. Public for the test suite.- Parameters:
localeArg- The locale specification, null implies the default locale.- Returns:
- True if the
Localechanged.
-
getRevision
public static java.lang.String getRevision()
Gets the current revision of game.- Returns:
- The current version and SVN Revision of the game.
-
getServerHost
public static java.lang.String getServerHost()
Get the default server host name.- Returns:
- The host name.
-
getServerPort
public static int getServerPort()
Gets the server network port.- Returns:
- The port number the server will be listening on.
-
getServerName
public static java.net.InetAddress getServerName()
Gets the server address.- Returns:
- The
InetAddressthe server will be listening on.
-
setServerPort
private static boolean setServerPort(java.lang.String arg)
Sets the server port.- Parameters:
arg- The server port number.- Returns:
- True if the port was set.
-
setServerAddress
private static boolean setServerAddress(java.lang.String arg)
Sets the server address.- Parameters:
arg- The server address.- Returns:
- True if the address was set.
-
getTC
public static java.lang.String getTC()
Gets the current Total-Conversion.- Returns:
- Usually TC_DEFAULT, but can be overridden at the command line.
-
setTC
public static void setTC(java.lang.String tc)
Sets the Total-Conversion. Called from NewPanel when a selection is made.- Parameters:
tc- The name of the new total conversion.
-
getTCFile
public static FreeColTcFile getTCFile()
Gets the FreeColTcFile for the current TC.- Returns:
- The
FreeColTcFile.
-
getTimeout
public static long getTimeout(boolean singlePlayer)
Gets the timeout. Use the command line specified one if any, otherwise default to `infinite' in single player and the TIMEOUT_DEFAULT for multiplayer.- Parameters:
singlePlayer- True if this is a single player game.- Returns:
- A suitable timeout value.
-
setTimeout
public static void setTimeout(java.lang.String timeout)
Sets the timeout.- Parameters:
timeout- A string containing the new timeout.
-
getVersion
public static java.lang.String getVersion()
Gets the current version of game.- Returns:
- The current version of the game using the format "x.y.z", where "x" is major, "y" is minor and "z" is revision.
-
getFreeColProtocolVersion
public static java.lang.String getFreeColProtocolVersion()
Gets the current version of the FreeCol protocol.- Returns:
- The version of the FreeCol protocol.
-
setWindowSize
private static void setWindowSize(java.lang.String arg)
Sets the window size. Does not fail because any empty or invalid value is interpreted as `windowed but use as much screen as possible'.- Parameters:
arg- The window size specification.
-
badFile
public static StringTemplate badFile(java.lang.String messageId, java.io.File file)
Generate a failure message depending on a file parameter.- Parameters:
messageId- The failure message identifier.file- TheFilethat caused the failure.- Returns:
- A
StringTemplatewith the error message.
-
errorFromException
public static StringTemplate errorFromException(java.lang.Exception ex, java.lang.String fallbackKey)
Build an error template from an exception.- Parameters:
ex- TheExceptionto make an error from.fallbackKey- A message key to use to make a fallback message if the exception is unsuitable.- Returns:
- An error
StringTemplate.
-
errorFromException
public static StringTemplate errorFromException(java.lang.Exception ex, StringTemplate fallback)
Build an error template from an exception.- Parameters:
ex- TheExceptionto make an error from.fallback- AStringTemplateto use as a fall back if the exception is unsuitable.- Returns:
- An error
StringTemplate.
-
getConfiguration
public static java.lang.StringBuilder getConfiguration()
We get a lot of lame bug reports with insufficient configuration information. Get a buffer containing as much information as we can to embed in the log file and saved games.- Returns:
- A
StringBuilderfull of configuration information.
-
startClient
private static void startClient()
Start a client.
-
createSplashScreen
private static SplashScreen createSplashScreen()
-
startTestClient
public static FreeColClient startTestClient(Specification spec)
Wrapper for the test suite to start a test client.- Parameters:
spec- TheSpecificationto use in the new client.- Returns:
- The new
FreeColClient.
-
checkServerIntegrity
private static void checkServerIntegrity(FreeColServer freeColServer)
Check the integrity of a FreeCol server.- Parameters:
freeColServer- The server to check.
-
startServer
private static void startServer()
Start the server.
-
-