Package pro.gravit.launcher.modules
Class LauncherModule
- java.lang.Object
-
- pro.gravit.launcher.modules.LauncherModule
-
public abstract class LauncherModule extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLauncherModule.Eventstatic interfaceLauncherModule.EventHandler<T extends LauncherModule.Event>static classLauncherModule.InitStatusModule initialization status at the current time
-
Field Summary
Fields Modifier and Type Field Description protected LauncherModule.InitStatusinitStatusprotected LauncherModuleInfomoduleInfoprotected ModulesConfigManagermodulesConfigManagerprotected LauncherModulesManagermodulesManager
-
Constructor Summary
Constructors Modifier Constructor Description protectedLauncherModule()protectedLauncherModule(LauncherModuleInfo info)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <T extends LauncherModule.Event>
voidcallEvent(T event)Call the handler of the current modulepro.gravit.launcher.LauncherTrustManager.CheckClassResultgetCheckResult()pro.gravit.launcher.LauncherTrustManager.CheckClassResultTypegetCheckStatus()LauncherModule.InitStatusgetInitStatus()LauncherModuleInfogetModuleInfo()abstract voidinit(LauncherInitContext initContext)Basic module initialization method You can: - Subscribe to events - Use your dependencies - Use provided initContext - Receive modules and access the module’s internal methods You can not: - Modify module description, dependencies - Add modules - Read configurationLauncherModulepreInit()voidpreInitAction()This method is called before initializing all modules and resolving dependencies.protected <T extends LauncherModule.Event>
booleanregisterEvent(LauncherModule.EventHandler<T> handle, java.lang.Class<T> tClass)Registers an event handler for the current modulevoidsetCheckResult(pro.gravit.launcher.LauncherTrustManager.CheckClassResult result)The internal method used by the ModuleManager DO NOT TOUCHvoidsetContext(LauncherModulesContext context)The internal method used by the ModuleManager DO NOT TOUCHLauncherModulesetInitStatus(LauncherModule.InitStatus initStatus)
-
-
-
Field Detail
-
moduleInfo
protected final LauncherModuleInfo moduleInfo
-
modulesManager
protected LauncherModulesManager modulesManager
-
modulesConfigManager
protected ModulesConfigManager modulesConfigManager
-
initStatus
protected LauncherModule.InitStatus initStatus
-
-
Constructor Detail
-
LauncherModule
protected LauncherModule()
-
LauncherModule
protected LauncherModule(LauncherModuleInfo info)
-
-
Method Detail
-
getModuleInfo
public LauncherModuleInfo getModuleInfo()
-
getInitStatus
public LauncherModule.InitStatus getInitStatus()
-
setInitStatus
public LauncherModule setInitStatus(LauncherModule.InitStatus initStatus)
-
setContext
public final void setContext(LauncherModulesContext context)
The internal method used by the ModuleManager DO NOT TOUCH- Parameters:
context- Private context
-
setCheckResult
public final void setCheckResult(pro.gravit.launcher.LauncherTrustManager.CheckClassResult result)
The internal method used by the ModuleManager DO NOT TOUCH- Parameters:
result- Check result
-
getCheckStatus
public final pro.gravit.launcher.LauncherTrustManager.CheckClassResultType getCheckStatus()
-
getCheckResult
public final pro.gravit.launcher.LauncherTrustManager.CheckClassResult getCheckResult()
-
preInitAction
public void preInitAction()
This method is called before initializing all modules and resolving dependencies. You can: - Use to Module Manager - Add custom modules not described in the manifest - Change information about your module or modules you control You can not: - Use your dependencies - Use Launcher, LaunchServer, ServerWrapper API - Change the names of any modules
-
preInit
public LauncherModule preInit()
-
init
public abstract void init(LauncherInitContext initContext)
Basic module initialization method You can: - Subscribe to events - Use your dependencies - Use provided initContext - Receive modules and access the module’s internal methods You can not: - Modify module description, dependencies - Add modules - Read configuration- Parameters:
initContext- null on module initialization during boot or startup Not null during module initialization while running
-
registerEvent
protected <T extends LauncherModule.Event> boolean registerEvent(LauncherModule.EventHandler<T> handle, java.lang.Class<T> tClass)
Registers an event handler for the current module- Type Parameters:
T- event type- Parameters:
handle- your event handlertClass- event class- Returns:
- true if adding a handler was successful
-
callEvent
public final <T extends LauncherModule.Event> void callEvent(T event)
Call the handler of the current module- Type Parameters:
T- event type- Parameters:
event- event handled
-
-