Interface FlectonePulse

All Superinterfaces:
LoaderBootstrap

public interface FlectonePulse extends LoaderBootstrap
Main interface for accessing FlectonePulse API functionality. Provides dependency injection capabilities and plugin lifecycle management.

Example usage:

// Get the FlectonePulse instance
FlectonePulse flectonePulse = FlectonePulseAPI.getInstance();

// Check if the injector is ready
if (flectonePulse.isReady()) {
    // Get a dependency
    FLogger logger = flectonePulse.get(FLogger.class);
    logger.info("Hello world");
}
Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    get(Class<T> type)
    Retrieves an instance of the specified class through dependency injection.
    @NonNull Object
    Returns the platform-specific plugin loader instance.
    boolean
    Checks if the dependency injector is ready to provide instances.
    void
    Reloads the FlectonePulse configuration and modules.
    default void
    Throws an InitException with the message from the provided exception.

    Methods inherited from interface LoaderBootstrap

    hook, onDisable, onEnable, onLoad
  • Method Details

    • reload

      void reload() throws ReloadException
      Reloads the FlectonePulse configuration and modules.

      This method reinitializes the plugin with updated configuration files and should be called when configuration changes are made at runtime.

      Throws:
      ReloadException - if an error occurs during reload
      See Also:
    • getLoader

      @NonNull Object getLoader()
      Returns the platform-specific plugin loader instance.

      This object represents the native plugin or mod container for the current server implementation (e.g., JavaPlugin on Bukkit, Plugin on BungeeCord, Object on Velocity). It can be used to access platform APIs that are not abstracted by the FlectonePulse interface.

      Returns:
      the native loader instance
    • get

      <T> T get(Class<T> type)
      Retrieves an instance of the specified class through dependency injection. Uses Google Guice as the underlying dependency injection framework.
      Type Parameters:
      T - the type of instance to retrieve
      Parameters:
      type - the class of the instance to retrieve
      Returns:
      an instance of the requested type
      Throws:
      IllegalStateException - if the injector is not ready
      See Also:
    • isReady

      boolean isReady()
      Checks if the dependency injector is ready to provide instances.

      Important: Always call this method before get(Class) to ensure the injector has been properly initialized.

      Returns:
      true if the injector is ready, false otherwise
      See Also:
    • throwInitException

      default void throwInitException(Exception e) throws InitException
      Throws an InitException with the message from the provided exception.

      In production mode (when -Dflectonepulse.debug is not set to true), the error message is truncated to the first 25 lines to prevent excessive log output. In debug mode, the full exception message is preserved.

      Parameters:
      e - the original exception whose message will be included in the InitException
      Throws:
      InitException - always thrown with the processed error message