Package de.craftsblock.craftsnet.builder
Class AddonContainingBuilder
java.lang.Object
de.craftsblock.craftsnet.builder.CraftsNetBuilder
de.craftsblock.craftsnet.builder.AddonContainingBuilder
Builder class for configuring the CraftsNet with a set of addons.
- Since:
- 3.1.0-SNAPSHOT
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAddonContainingBuilder(Collection<Class<? extends Addon>> addons) Creates a new instance ofAddonContainingBuilderwith providing a collection containingAddonclasses. -
Method Summary
Modifier and TypeMethodDescriptionaddCodeSource(CodeSource codeSource) Adds aCodeSourceto the code sources list.build()Builds and starts the CraftsNet framework with the configured settings.Collection<Class<? extends Addon>>Gets all the currently registeredAddonclasses which should be loaded.voidloadAddons(CraftsNet craftsNet) Load all the addons that have been registered in the builder.Maps an addon class to a custom name.removeCodeSource(CodeSource codeSource) Removes aCodeSourcefrom the code sources list.withAddonSystem(ActivateType type) Specifies the activation type for the addon system.withApplyResponseEncoding(boolean allowed) Specifies whether from the client requested response encodings should be applied or not.Configures the builder using a set of command-line arguments.Specifies the activation type for the command system.withCustomLogger(Logger logger) Sets a custom logger which will be used by CraftsNet.withDebug(boolean enabled) Specifies whether debug mode should be enabled.withFileLogger(ActivateType type) Specifies the activation type for the file logger.withIpsInLog(boolean enabled) Specifies whether ips should be blurred in the log output.withLogger(ActivateType type) Specifies the activation type for the logger.withLogRotate(@org.jetbrains.annotations.Range(from=0L, to=9223372036854775807L) long logRotate) Sets the log rotation size threshold for this builder.Disables log rotation by setting the log rotation size threshold to 0.withSessionCache(int size) Specifies the size of the session cache.withSkipDefaultRoute(boolean skip) Specifies whether the registration of the default route (if no other route was registered) should be skipped on startup.withSkipVersionCheck(boolean skip) Specifies whether the version check should be skipped on startup.withSSL(boolean enabled) Specifies whether SSL should be enabled.withTempFilesOnNormalFileSystem(boolean tempFilesOnNormalFileSystem) Configures whether temporary files should be placed on the normal file system.withWebServer(int port) Specifies the port for the web server.withWebServer(ActivateType type) Specifies the port for the web server.withWebServer(ActivateType type, int port) Specifies the activation type and port for the web server.withWebSocketServer(int port) Specifies the port for the WebSocket server.Specifies the activation type and port for the WebSocket server.withWebSocketServer(ActivateType type, int port) Specifies the activation type and port for the WebSocket server.Methods inherited from class de.craftsblock.craftsnet.builder.CraftsNetBuilder
getAddonSystem, getCodeSources, getCommandSystem, getCustomLogger, getLogRotate, getSessionCacheSize, getWebServer, getWebServerPort, getWebSocketServer, getWebSocketServerPort, isAddonSystem, isCommandSystem, isDebug, isFileLogger, isLogRotate, isSSL, isWebServer, isWebSocketServer, responseEncodingAllowed, setArg, shouldHideIps, shouldPlaceTempFilesOnNormalFileSystem, shouldSkipDefaultRoute, shouldSkipVersionCheck
-
Constructor Details
-
AddonContainingBuilder
Creates a new instance ofAddonContainingBuilderwith providing a collection containingAddonclasses.- Parameters:
addons- A collection containing allAddonclasses which should be loaded.
-
-
Method Details
-
map
Maps an addon class to a custom name.- Parameters:
type- The addon class.name- The name to associate with the addon class.- Returns:
- The
AddonContainingBuilderinstance.
-
withArgs
Configures the builder using a set of command-line arguments.Parses the provided arguments and applies corresponding settings to the builder. If a specific argument is not recognized, an exception is thrown.
- Overrides:
withArgsin classCraftsNetBuilder- Parameters:
args- An array of command-line arguments to parse.- Returns:
- The current instance of
CraftsNetBuilderfor chaining.
-
addCodeSource
Adds aCodeSourceto the code sources list.- Overrides:
addCodeSourcein classCraftsNetBuilder- Parameters:
codeSource- TheCodeSourcethat should be added.- Returns:
- The
CraftsNetBuilderinstance.
-
removeCodeSource
Removes aCodeSourcefrom the code sources list.- Overrides:
removeCodeSourcein classCraftsNetBuilder- Parameters:
codeSource- TheCodeSourcethat should be removed.- Returns:
- The
CraftsNetBuilderinstance.
-
withWebServer
Specifies the port for the web server.- Overrides:
withWebServerin classCraftsNetBuilder- Parameters:
port- The port number for the web server.- Returns:
- The
CraftsNetBuilderinstance.
-
withWebServer
Specifies the port for the web server.- Overrides:
withWebServerin classCraftsNetBuilder- Parameters:
type- The activation type for the web server.- Returns:
- The
CraftsNetBuilderinstance.
-
withWebServer
Specifies the activation type and port for the web server.- Overrides:
withWebServerin classCraftsNetBuilder- Parameters:
type- The activation type for the web server.port- The port number for the web server.- Returns:
- The
CraftsNetBuilderinstance.
-
withWebSocketServer
Specifies the port for the WebSocket server.- Overrides:
withWebSocketServerin classCraftsNetBuilder- Parameters:
port- The port number for the WebSocket server.- Returns:
- The
CraftsNetBuilderinstance.
-
withWebSocketServer
Specifies the activation type and port for the WebSocket server.- Overrides:
withWebSocketServerin classCraftsNetBuilder- Parameters:
type- The activation type for the WebSocket server.- Returns:
- The
CraftsNetBuilderinstance.
-
withWebSocketServer
Specifies the activation type and port for the WebSocket server.- Overrides:
withWebSocketServerin classCraftsNetBuilder- Parameters:
type- The activation type for the WebSocket server.port- The port number for the WebSocket server.- Returns:
- The
CraftsNetBuilderinstance.
-
withAddonSystem
Specifies the activation type for the addon system.- Overrides:
withAddonSystemin classCraftsNetBuilder- Parameters:
type- The activation type for the addon system.- Returns:
- The
CraftsNetBuilderinstance.
-
withCommandSystem
Specifies the activation type for the command system.- Overrides:
withCommandSystemin classCraftsNetBuilder- Parameters:
type- The activation type for the command system.- Returns:
- The
CraftsNetBuilderinstance.
-
withSessionCache
Specifies the size of the session cache.- Overrides:
withSessionCachein classCraftsNetBuilder- Parameters:
size- The size of the session cache.- Returns:
- The
CraftsNetBuilderinstance.
-
withFileLogger
Specifies the activation type for the file logger.- Overrides:
withFileLoggerin classCraftsNetBuilder- Parameters:
type- The activation type for the file logger.- Returns:
- The
CraftsNetBuilderinstance.
-
withApplyResponseEncoding
Specifies whether from the client requested response encodings should be applied or not.- Overrides:
withApplyResponseEncodingin classCraftsNetBuilder- Parameters:
allowed-trueif the requested response encoding should be applied,falseotherwise.- Returns:
- The
CraftsNetBuilderinstance. - Since:
- 3.3.3-SNAPSHOT
-
withTempFilesOnNormalFileSystem
Configures whether temporary files should be placed on the normal file system. When set totrue, the application will store temporary files in the local file system instead of using the system's default temporary file location.- Overrides:
withTempFilesOnNormalFileSystemin classCraftsNetBuilder- Parameters:
tempFilesOnNormalFileSystem-trueto place temporary files in the normal file system,falseotherwise.- Returns:
- the current
CraftsNetBuilderinstance for method chaining.
-
withSkipDefaultRoute
Specifies whether the registration of the default route (if no other route was registered) should be skipped on startup.- Overrides:
withSkipDefaultRoutein classCraftsNetBuilder- Parameters:
skip-trueif the version check should be skipped,falseotherwise.- Returns:
- The
CraftsNetBuilderinstance. - Since:
- 3.3.3-SNAPSHOT
-
withSkipVersionCheck
Specifies whether the version check should be skipped on startup.- Overrides:
withSkipVersionCheckin classCraftsNetBuilder- Parameters:
skip-trueif the version check should be skipped, false otherwise.- Returns:
- The
CraftsNetBuilderinstance.
-
withCustomLogger
Sets a custom logger which will be used by CraftsNet. It can be null when the default logger should be used.- Overrides:
withCustomLoggerin classCraftsNetBuilder- Parameters:
logger- The instance of the custom logger.- Returns:
- The
CraftsNetBuilderinstance.
-
withLogger
Specifies the activation type for the logger.- Overrides:
withLoggerin classCraftsNetBuilder- Parameters:
type- The activation type for the logger.- Returns:
- The
CraftsNetBuilderinstance.
-
withDebug
Specifies whether debug mode should be enabled.- Overrides:
withDebugin classCraftsNetBuilder- Parameters:
enabled-trueif debug mode should be enabled,falseotherwise.- Returns:
- The
CraftsNetBuilderinstance.
-
withIpsInLog
Specifies whether ips should be blurred in the log output.- Overrides:
withIpsInLogin classCraftsNetBuilder- Parameters:
enabled-trueif ips should be readable in the log,falseotherwise.- Returns:
- The
CraftsNetBuilderinstance.
-
withSSL
Specifies whether SSL should be enabled.- Overrides:
withSSLin classCraftsNetBuilder- Parameters:
enabled-trueif SSL should be enabled,falseotherwise.- Returns:
- The
CraftsNetBuilderinstance.
-
withLogRotate
public AddonContainingBuilder withLogRotate(@org.jetbrains.annotations.Range(from=0L, to=9223372036854775807L) long logRotate) Sets the log rotation size threshold for this builder.- Overrides:
withLogRotatein classCraftsNetBuilder- Parameters:
logRotate- the log rotation size threshold, in bytes. A value of 0 disables log rotation. Must be non-negative.- Returns:
- this
CraftsNetBuilderinstance, enabling method chaining.
-
withoutLogRotate
Disables log rotation by setting the log rotation size threshold to 0.- Overrides:
withoutLogRotatein classCraftsNetBuilder- Returns:
- this
CraftsNetBuilderinstance, enabling method chaining.
-
build
Builds and starts the CraftsNet framework with the configured settings.- Overrides:
buildin classCraftsNetBuilder- Returns:
- The constructed CraftsNet instance.
- Throws:
IOException- If an I/O error occurs during the startup process.
-
loadAddons
Load all the addons that have been registered in the builder.- Parameters:
craftsNet- The instance of CraftsNet that the addons should be registered on.
-
getAddons
Gets all the currently registeredAddonclasses which should be loaded.- Returns:
- A
CollectionofAddonclasses.
-