Class CraftsNet

java.lang.Object
de.craftsblock.craftsnet.CraftsNet

public class CraftsNet extends Object
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 Details

  • Constructor Details

    • CraftsNet

      public CraftsNet()
  • Method Details

    • main

      public static void main(String[] args) throws IOException
      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

      public void start(CraftsNetBuilder builder) throws IOException
      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

      public void restart(Runnable executeBetween)
      Restarts the CraftsNet framework.
      Parameters:
      executeBetween - A Runnable which 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.
      Use getAddonManager() instead. This will be removed in the future.
      Retrieves the addon manager instance for managing addons.
      Returns:
      The addon manager instance.
    • getAddonManager

      public AddonManager 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.
      Use getAutoRegisterRegistry() 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

      public AutoRegisterRegistry 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.
      Use getBodyRegistry() 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

      public BodyRegistry 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.
      Use getCommandRegistry() instead. This will be removed in the future.
      Retrieves the command registry instance for managing commands.
      Returns:
      The command registry instance.
    • getCommandRegistry

      public CommandRegistry 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.
      Use getListenerRegistry() 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.
      Use getMiddlewareRegistry() instead. This will be removed in the future.
      Retrieves the middleware registry instance for manging middlewares
      Returns:
      The middleware registry instance.
      Since:
      3.4.0-SNAPSHOT
    • getMiddlewareRegistry

      public MiddlewareRegistry getMiddlewareRegistry()
      Retrieves the middleware registry instance for manging middlewares
      Returns:
      The middleware registry instance.
      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.
      Use getRequirementRegistry() 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

      public RequirementRegistry 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.
      Use getRouteRegistry() 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

      public RouteRegistry 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.
      Use getServiceManager() instead. This will be removed in the future.
      Retrieves the service manager instance for managing services.
      Returns:
      The service manager instance.
    • getServiceManager

      public ServiceManager 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.
      Use getSessionCache() ()} 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

      public SessionCache 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.
      Use getStreamEncoderRegistry() ()} 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

      public StreamEncoderRegistry getStreamEncoderRegistry()
      Retrieves the stream encoder registry instance for managing stream encoders.
      Returns:
      The stream encoder registry instance.
    • getWebSocketEncoderRegistry

      public TypeEncoderRegistry<WebSocketSafeTypeEncoder<?,?>> getWebSocketEncoderRegistry()
      Retrieves the TypeEncoderRegistry dedicated to managing WebSocketSafeTypeEncoder instances used by the WebSocketServer.
      Returns:
      the TypeEncoderRegistry for WebSocketSafeTypeEncoder codecs
    • 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.
      Use getFileHelper() instead. This will be removed in the future.
      Retrieves the extension registry for the websocket protocol.
      Returns:
      The websocket extension registry.
    • getWebSocketExtensionRegistry

      public WebSocketExtensionRegistry 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.
      Use getWebServer() instead. This will be removed in the future.
      Retrieves the web server instance for handling HTTP requests.
      Returns:
      The web server instance.
    • getWebServer

      public WebServer 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.
      Use getWebSocketServer() instead. This will be removed in the future.
      Retrieves the WebSocket server instance for handling WebSocket connections.
      Returns:
      The WebSocket server instance.
    • getWebSocketServer

      public WebSocketServer 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.
      Use getLogger() instead. This will be removed in the future.
      Retrieves the logger instance for logging messages.
      Returns:
      The logger instance.
    • getLogger

      public Logger 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.
      Use getLogStream() instead. This will be removed in the future.
      Retrieves the LogStream instance for advanced log creation.
      Returns:
      The LogStream instance.
    • getLogStream

      public LogStream getLogStream()
      Retrieves the LogStream instance for advanced log creation.
      Returns:
      The LogStream instance.
    • getBuilder

      public CraftsNetBuilder 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.
      Use getFileHelper() instead. This will be removed in the future.
      Returns the FileHelper instance used for handling temporary files.
      Returns:
      the FileHelper instance.
    • getFileHelper

      public FileHelper getFileHelper()
      Returns the FileHelper instance used for handling temporary files.
      Returns:
      the FileHelper instance.
    • create

      public static CraftsNetBuilder create()
      Creates a new builder instance for configuring CraftsNet.
      Returns:
      A new builder instance.
    • create

      @SafeVarargs public static AddonContainingBuilder create(Class<? extends Addon>... addons)
      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 of Addon classes to include in the configuration.
      Returns:
      A new AddonContainingBuilder instance initialized with the specified addons.
    • create

      public static AddonContainingBuilder create(Collection<Class<? extends Addon>> addons)
      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 - A Collection of Addon classes to include in the configuration.
      Returns:
      A new AddonContainingBuilder instance initialized with the specified addons.