Interface FlectonePulse
- All Superinterfaces:
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 TypeMethodDescription<T> TRetrieves an instance of the specified class through dependency injection.@NonNull ObjectReturns the platform-specific plugin loader instance.booleanisReady()Checks if the dependency injector is ready to provide instances.voidreload()Reloads the FlectonePulse configuration and modules.default voidThrows an InitException with the message from the provided exception.Methods inherited from interface LoaderBootstrap
hook, onDisable, onEnable, onLoad
-
Method Details
-
reload
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.,
JavaPluginon Bukkit,Pluginon BungeeCord,Objecton Velocity). It can be used to access platform APIs that are not abstracted by the FlectonePulse interface.- Returns:
- the native loader instance
-
get
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:
trueif the injector is ready,falseotherwise- See Also:
-
throwInitException
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
-