Interface FlectonePulse


public interface FlectonePulse
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
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes all open user interfaces including inventories and dialogs.
    default <T> T
    get(Class<T> type)
    Retrieves an instance of the specified class through dependency injection.
    com.google.inject.Injector
    Gets the Google Guice Injector instance used for dependency injection.
    void
    Initialize the PacketAdapter API.
    default boolean
    Checks if the dependency injector is ready to provide instances.
    void
    Called when the FlectonePulse is disabled.
    void
    Called when the FlectonePulse is enabled.
    void
    Reloads the FlectonePulse configuration and modules.
    void
    Terminates PacketAdapter API if initialization failed.
    void
    Terminates the PacketAdapter API and cleans up related resources.
    default void
    Throws an InitException with the message from the provided exception.
  • Method Details

    • getInjector

      com.google.inject.Injector getInjector()
      Gets the Google Guice Injector instance used for dependency injection. This injector is responsible for creating and managing instances of FlectonePulse components and services.
      Returns:
      the Injector instance, or null if not initialized
      See Also:
    • onEnable

      void onEnable()
      Called when the FlectonePulse is enabled.

      This method initializes the dependency injector and prepares the FlectonePulse for operation. It should only be called by the FlectonePulse itself.

    • onDisable

      void onDisable()
      Called when the FlectonePulse is disabled.

      This method cleans up resources and shuts down FlectonePulse modules. It should only be called by the FlectonePulse itself.

    • 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:
    • initPacketAdapter

      void initPacketAdapter()
      Initialize the PacketAdapter API.
    • terminateFailedPacketAdapter

      void terminateFailedPacketAdapter()
      Terminates PacketAdapter API if initialization failed. Prevents errors when FlectonePulse fails to start.
    • terminatePacketAdapter

      void terminatePacketAdapter()
      Terminates the PacketAdapter API and cleans up related resources.
    • closeUIs

      void closeUIs()
      Closes all open user interfaces including inventories and dialogs.
    • get

      default <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.

      Note: Most FlectonePulse classes (except models) are marked with @Singleton.

      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

      default 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