Package de.craftsblock.craftsnet
Class CraftsNet
java.lang.Object
de.craftsblock.craftsnet.CraftsNet
CraftsNet class represents the core component of the CraftsNet framework,
providing functionalities for managing various aspects of the system.
- Since:
- 1.0.0-SNAPSHOT
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.UsegetAutoRegisterRegistry()instead.Deprecated, for removal: This API element is subject to removal in a future version.UsegetBodyRegistry()instead.Deprecated, for removal: This API element is subject to removal in a future version.UsegetCommandRegistry()instead.static CraftsNetBuildercreate()Creates a new builder instance for configuring CraftsNet.static AddonContainingBuilderCreates a new builder instance for configuring CraftsNet with the specified addons.static AddonContainingBuildercreate(Collection<Class<? extends Addon>> addons) Creates a new builder instance for configuring CraftsNet with the specified addons.Deprecated, for removal: This API element is subject to removal in a future version.UsegetFileHelper()instead.Retrieves the addon manager instance for managing addons.Retrieves the auto register registry instance for auto registrable types.Retrieves the body registry instance for manging body types.Retrieves the builder instance used for configuring CraftsNet.Retrieves the command registry instance for managing commands.Returns theFileHelperinstance used for handling temporary files.de.craftsblock.craftscore.event.ListenerRegistryRetrieves the listener registry instance for managing event listeners.Retrieves the logger instance for logging messages.Retrieves theLogStreaminstance for advanced log creation.Retrieves the middleware registry instance for mangingmiddlewaresRetrieves the route registry instance for managing web and web requirements.Retrieves the route registry instance for managing web and web socket routes.Retrieves the service manager instance for managing services.Retrieves the session cache instance which is in charge of caching session.Retrieves the stream encoder registry instance for managing stream encoders.Retrieves the web server instance for handling HTTP requests.Retrieves theTypeEncoderRegistrydedicated to managingWebSocketSafeTypeEncoderinstances used by theWebSocketServer.Retrieves the extension registry for the websocket protocol.Retrieves the WebSocket server instance for handling WebSocket connections.de.craftsblock.craftscore.event.ListenerRegistryDeprecated, for removal: This API element is subject to removal in a future version.UsegetListenerRegistry()instead.logger()Deprecated, for removal: This API element is subject to removal in a future version.UsegetLogger()instead.Deprecated, for removal: This API element is subject to removal in a future version.UsegetLogStream()instead.static voidThe main method is the entry point of the application.Deprecated, for removal: This API element is subject to removal in a future version.UsegetMiddlewareRegistry()instead.Deprecated, for removal: This API element is subject to removal in a future version.UsegetRequirementRegistry()instead.voidrestart()Restarts the CraftsNet framework.voidRestarts the CraftsNet framework.Deprecated, for removal: This API element is subject to removal in a future version.UsegetRouteRegistry()instead.Deprecated, for removal: This API element is subject to removal in a future version.UsegetServiceManager()instead.Deprecated, for removal: This API element is subject to removal in a future version.UsegetSessionCache()()} instead.voidstart(CraftsNetBuilder builder) Starts the CraftsNet framework with the provided builder configuration.voidstop()Stops the CraftsNet framework.Deprecated, for removal: This API element is subject to removal in a future version.UsegetStreamEncoderRegistry()()} instead.Deprecated, for removal: This API element is subject to removal in a future version.UsegetWebServer()instead.Deprecated, for removal: This API element is subject to removal in a future version.UsegetFileHelper()instead.Deprecated, for removal: This API element is subject to removal in a future version.UsegetWebSocketServer()instead.
-
Field Details
-
version
- See Also:
-
-
Constructor Details
-
CraftsNet
public CraftsNet()
-
-
Method Details
-
main
The main method is the entry point of the application. It parses command-line arguments, initializes the backend- Parameters:
args- The command-line arguments passed to the application.- Throws:
IOException- If an I/O error occurs while starting the servers.
-
start
Starts the CraftsNet framework with the provided builder configuration.- Parameters:
builder- The builder instance containing the configuration for starting CraftsNet.- Throws:
IOException- If an I/O error occurs during the startup process.
-
stop
public void stop()Stops the CraftsNet framework. -
restart
public void restart()Restarts the CraftsNet framework. -
restart
Restarts the CraftsNet framework.- Parameters:
executeBetween- ARunnablewhich is before the new instance is started.
-
addonManager
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public AddonManager addonManager()Deprecated, for removal: This API element is subject to removal in a future version.UsegetAddonManager()instead. This will be removed in the future.Retrieves the addon manager instance for managing addons.- Returns:
- The addon manager instance.
-
getAddonManager
Retrieves the addon manager instance for managing addons.- Returns:
- The addon manager instance.
-
autoRegisterRegistry
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public AutoRegisterRegistry autoRegisterRegistry()Deprecated, for removal: This API element is subject to removal in a future version.UsegetAutoRegisterRegistry()instead. This will be removed in the future.Retrieves the auto register registry instance for auto registrable types.- Returns:
- The auto register registry instance.
- Since:
- 3.2.0-SNAPSHOT
-
getAutoRegisterRegistry
Retrieves the auto register registry instance for auto registrable types.- Returns:
- The auto register registry instance.
- Since:
- 3.2.0-SNAPSHOT
-
bodyRegistry
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public BodyRegistry bodyRegistry()Deprecated, for removal: This API element is subject to removal in a future version.UsegetBodyRegistry()instead. This will be removed in the future.Retrieves the body registry instance for manging body types.- Returns:
- The body registry instance.
- Since:
- 3.0.4-SNAPSHOT
-
getBodyRegistry
Retrieves the body registry instance for manging body types.- Returns:
- The body registry instance.
- Since:
- 3.0.4-SNAPSHOT
-
commandRegistry
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public CommandRegistry commandRegistry()Deprecated, for removal: This API element is subject to removal in a future version.UsegetCommandRegistry()instead. This will be removed in the future.Retrieves the command registry instance for managing commands.- Returns:
- The command registry instance.
-
getCommandRegistry
Retrieves the command registry instance for managing commands.- Returns:
- The command registry instance.
-
listenerRegistry
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public de.craftsblock.craftscore.event.ListenerRegistry listenerRegistry()Deprecated, for removal: This API element is subject to removal in a future version.UsegetListenerRegistry()instead. This will be removed in the future.Retrieves the listener registry instance for managing event listeners.- Returns:
- The listener registry instance.
-
getListenerRegistry
public de.craftsblock.craftscore.event.ListenerRegistry getListenerRegistry()Retrieves the listener registry instance for managing event listeners.- Returns:
- The listener registry instance.
-
middlewareRegistry
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public MiddlewareRegistry middlewareRegistry()Deprecated, for removal: This API element is subject to removal in a future version.UsegetMiddlewareRegistry()instead. This will be removed in the future.Retrieves the middleware registry instance for mangingmiddlewares- Returns:
- The
middleware registryinstance. - Since:
- 3.4.0-SNAPSHOT
-
getMiddlewareRegistry
Retrieves the middleware registry instance for mangingmiddlewares- Returns:
- The
middleware registryinstance. - Since:
- 3.4.0-SNAPSHOT
-
requirementRegistry
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public RequirementRegistry requirementRegistry()Deprecated, for removal: This API element is subject to removal in a future version.UsegetRequirementRegistry()instead. This will be removed in the future.Retrieves the route registry instance for managing web and web requirements.- Returns:
- The requirement registry instance.
- Since:
- 3.2.1-SNAPSHOT
-
getRequirementRegistry
Retrieves the route registry instance for managing web and web requirements.- Returns:
- The requirement registry instance.
- Since:
- 3.2.1-SNAPSHOT
-
routeRegistry
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public RouteRegistry routeRegistry()Deprecated, for removal: This API element is subject to removal in a future version.UsegetRouteRegistry()instead. This will be removed in the future.Retrieves the route registry instance for managing web and web socket routes.- Returns:
- The route registry instance.
-
getRouteRegistry
Retrieves the route registry instance for managing web and web socket routes.- Returns:
- The route registry instance.
-
serviceManager
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public ServiceManager serviceManager()Deprecated, for removal: This API element is subject to removal in a future version.UsegetServiceManager()instead. This will be removed in the future.Retrieves the service manager instance for managing services.- Returns:
- The service manager instance.
-
getServiceManager
Retrieves the service manager instance for managing services.- Returns:
- The service manager instance.
-
sessionCache
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public SessionCache sessionCache()Deprecated, for removal: This API element is subject to removal in a future version.UsegetSessionCache()()} instead. This will be removed in the future.Retrieves the session cache instance which is in charge of caching session.- Returns:
- The session cache instance.
-
getSessionCache
Retrieves the session cache instance which is in charge of caching session.- Returns:
- The session cache instance.
-
streamEncoderRegistry
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public StreamEncoderRegistry streamEncoderRegistry()Deprecated, for removal: This API element is subject to removal in a future version.UsegetStreamEncoderRegistry()()} instead. This will be removed in the future.Retrieves the stream encoder registry instance for managing stream encoders.- Returns:
- The stream encoder registry instance.
-
getStreamEncoderRegistry
Retrieves the stream encoder registry instance for managing stream encoders.- Returns:
- The stream encoder registry instance.
-
getWebSocketEncoderRegistry
Retrieves theTypeEncoderRegistrydedicated to managingWebSocketSafeTypeEncoderinstances used by theWebSocketServer.- Returns:
- the
TypeEncoderRegistryforWebSocketSafeTypeEncodercodecs
-
webSocketExtensionRegistry
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public WebSocketExtensionRegistry webSocketExtensionRegistry()Deprecated, for removal: This API element is subject to removal in a future version.UsegetFileHelper()instead. This will be removed in the future.Retrieves the extension registry for the websocket protocol.- Returns:
- The websocket extension registry.
-
getWebSocketExtensionRegistry
Retrieves the extension registry for the websocket protocol.- Returns:
- The websocket extension registry.
-
webServer
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public WebServer webServer()Deprecated, for removal: This API element is subject to removal in a future version.UsegetWebServer()instead. This will be removed in the future.Retrieves the web server instance for handling HTTP requests.- Returns:
- The web server instance.
-
getWebServer
Retrieves the web server instance for handling HTTP requests.- Returns:
- The web server instance.
-
webSocketServer
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public WebSocketServer webSocketServer()Deprecated, for removal: This API element is subject to removal in a future version.UsegetWebSocketServer()instead. This will be removed in the future.Retrieves the WebSocket server instance for handling WebSocket connections.- Returns:
- The WebSocket server instance.
-
getWebSocketServer
Retrieves the WebSocket server instance for handling WebSocket connections.- Returns:
- The WebSocket server instance.
-
logger
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public Logger logger()Deprecated, for removal: This API element is subject to removal in a future version.UsegetLogger()instead. This will be removed in the future.Retrieves the logger instance for logging messages.- Returns:
- The logger instance.
-
getLogger
Retrieves the logger instance for logging messages.- Returns:
- The logger instance.
-
logStream
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public LogStream logStream()Deprecated, for removal: This API element is subject to removal in a future version.UsegetLogStream()instead. This will be removed in the future.Retrieves theLogStreaminstance for advanced log creation.- Returns:
- The
LogStreaminstance.
-
getLogStream
Retrieves theLogStreaminstance for advanced log creation.- Returns:
- The
LogStreaminstance.
-
getBuilder
Retrieves the builder instance used for configuring CraftsNet.- Returns:
- The builder instance.
-
fileHelper
@Deprecated(since="3.5.0", forRemoval=true) @ScheduledForRemoval(inVersion="3.6.0") public FileHelper fileHelper()Deprecated, for removal: This API element is subject to removal in a future version.UsegetFileHelper()instead. This will be removed in the future.Returns theFileHelperinstance used for handling temporary files.- Returns:
- the
FileHelperinstance.
-
getFileHelper
Returns theFileHelperinstance used for handling temporary files.- Returns:
- the
FileHelperinstance.
-
create
Creates a new builder instance for configuring CraftsNet.- Returns:
- A new builder instance.
-
create
Creates a new builder instance for configuring CraftsNet with the specified addons.Warning: There is currently a bug where autoregister classes gets mixed up when more than one addon is in the same jar file. Use with caution in production!
- Parameters:
addons- An array ofAddonclasses to include in the configuration.- Returns:
- A new
AddonContainingBuilderinstance initialized with the specified addons.
-
create
Creates a new builder instance for configuring CraftsNet with the specified addons.Warning: There is currently a bug where autoregister classes gets mixed up when more than one addon is in the same jar file. Use with caution in production!
- Parameters:
addons- ACollectionofAddonclasses to include in the configuration.- Returns:
- A new
AddonContainingBuilderinstance initialized with the specified addons.
-
getAddonManager()instead.